From 44b2cd4a0d7f23f5da843d529e7c14fffba74071 Mon Sep 17 00:00:00 2001 From: Jose Javier Merchante Date: Wed, 11 Sep 2024 11:12:10 +0200 Subject: [PATCH] Add missing status to Kitsune/SUMO index There is a new field in the enriched index, `status`, which contains the current status of the question. The status could be `solved`, `archived`, `locked`, or `open`. Signed-off-by: Jose Javier Merchante --- grimoire_elk/enriched/kitsune.py | 10 ++++ .../status-in-sumo-enriched-index.yml | 8 +++ schema/kitsune.csv | 58 +++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 releases/unreleased/status-in-sumo-enriched-index.yml create mode 100644 schema/kitsune.csv diff --git a/grimoire_elk/enriched/kitsune.py b/grimoire_elk/enriched/kitsune.py index 51f90fc7c..7dc3ebefc 100644 --- a/grimoire_elk/enriched/kitsune.py +++ b/grimoire_elk/enriched/kitsune.py @@ -183,6 +183,16 @@ def get_rich_item(self, item, kind='question', equestion=None): origin = item['origin'].rstrip('/') eitem['url'] = f"{origin}/{question['locale']}/questions/{question['id']}" + # Add status + if question['is_solved']: + eitem['status'] = 'solved' + elif question['is_archived']: + eitem['status'] = 'archived' + elif question['is_locked']: + eitem['status'] = 'locked' + else: + eitem['status'] = 'open' + eitem['author'] = question['creator']['username'] if question['creator']['display_name']: eitem['author'] = question['creator']['display_name'] diff --git a/releases/unreleased/status-in-sumo-enriched-index.yml b/releases/unreleased/status-in-sumo-enriched-index.yml new file mode 100644 index 000000000..ca5a7a754 --- /dev/null +++ b/releases/unreleased/status-in-sumo-enriched-index.yml @@ -0,0 +1,8 @@ +--- +title: Status in SUMO enriched index +category: added +author: Jose Javier Merchante +issue: null +notes: > + Add the missing status in the SUMO backend. The status could + be `solved`, `archived`, `locked` or `open`. diff --git a/schema/kitsune.csv b/schema/kitsune.csv new file mode 100644 index 000000000..e4fa8107b --- /dev/null +++ b/schema/kitsune.csv @@ -0,0 +1,58 @@ +name,type,aggregatable,description +answer_id,long,True,"Unique identifier for the answer." +author,keyword,True,"Name of the author." +author_bot,boolean,True,"Indicates whether the author is a bot." +author_gender,keyword,True,"Gender of the author." +author_gender_acc,long,True,"Accuracy or confidence level for the author's gender identification." +author_id,keyword,True,"Unique identifier for the author." +author_multi_org_names,keyword,True,"List of multiple organization names associated with the author." +author_name,keyword,True,"Full name of the author." +author_org_name,keyword,True,"Organization name associated with the author." +author_user_name,keyword,True,"Username of the author." +author_uuid,keyword,True,"Unique UUID for the author." +content,keyword,True,"Content of the post or answer as a single string." +content_analyzed,text,False,"Content of the post or answer, analyzed for searching." +creation_date,date,True,"Date when the content was created." +creator_bot,boolean,True,"Indicates whether the creator is a bot." +creator_gender,keyword,True,"Gender of the creator." +creator_gender_acc,long,True,"Accuracy or confidence level for the creator's gender identification." +creator_id,keyword,True,"Unique identifier for the creator." +creator_multi_org_names,keyword,True,"List of multiple organization names associated with the creator." +creator_name,keyword,True,"Full name of the creator." +creator_org_name,keyword,True,"Organization name associated with the creator." +creator_user_name,keyword,True,"Username of the creator." +creator_uuid,keyword,True,"Unique UUID for the creator." +grimoire_creation_date,date,True,"Date when the item was created upstream, typically the date the question or answer was created." +helpful_answer,long,True,"Field indicating whether the answer was marked as helpful." +id,keyword,True,"Unique identifier for the entity (question or answer)." +is_kitsune_answer,long,True,"Field containing '1' if the item is a Kitsune answer." +is_kitsune_question,long,True,"Field containing '1' if the item is a Kitsune question." +is_kitsune_question_solved,long,True,"Field containing '1' if the Kitsune question is marked as solved." +is_spam,boolean,True,"Field indicating whether the content is flagged as spam." +last_activity_date,date,True,"Date when the last activity occurred on the item (question or answer)." +lifetime_days,float,False,"The total lifetime of the question or answer in days." +locale,keyword,True,"Locale or language in which the content was written." +metadata__enriched_on,date,True,"Date when the item was enriched." +metadata__gelk_backend_name,keyword,True,"Name of the backend used to enrich information." +metadata__gelk_version,keyword,True,"Version of the backend used to enrich information." +metadata__timestamp,date,True,"Timestamp when the item was indexed." +metadata__updated_on,date,True,"Date when the item was updated in its original data source." +num_answers,long,True,"Number of answers associated with the question." +offset,long,True,"Offset of the document in the data source." +origin,keyword,True,"Original URL where the data was retrieved from." +product,keyword,True,"Product associated with the question or answer." +project,keyword,True,"Project name associated with the question or answer." +project_1,keyword,True,"Additional project information if multiple project levels exist." +question_id,long,True,"Unique identifier for the question." +score,long,True,"Score or rating given to the question or answer." +solution,long,True,"Field indicating whether the answer is marked as a solution." +status,keyword,True,"Status of the question or answer (open, archived, locked, solved)." +tag,keyword,True,"Tag associated with the origin." +tags,keyword,True,"List of tags associated with the question or answer." +tags_analyzed,text,False,"Tags analyzed for searching." +time_to_first_reply_hours,float,False,"Time taken to receive the first reply, measured in hours." +title,keyword,True,"Title of the question or answer." +type,keyword,True,"Type of content (e.g., question, answer)." +unhelpful_answer,long,True,"Field indicating whether the answer was marked as unhelpful." +url,keyword,True,"URL corresponding to the question or answer." +uuid,keyword,True,"Unique identifier (UUID) for the entity."