Skip to content

Commit

Permalink
[bugzilla] Include bug description in Bugzilla enriched
Browse files Browse the repository at this point in the history
Include the description of the bug in Bugzilla. The new fields
are 'description' and 'description_analyzed'. The second allows
to query any of the words of the description.

Signed-off-by: Jose Javier Merchante <jjmerchante@bitergia.com>
  • Loading branch information
jjmerchante committed Oct 4, 2023
1 parent f2a1ceb commit 117e2e3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
10 changes: 10 additions & 0 deletions grimoire_elk/enriched/bugzilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ def get_elastic_mappings(es_major):
"summary_analyzed": {
"type": "text",
"index": true
},
"description_analyzed": {
"type": "text",
"index": true
}
}
}"""
Expand Down Expand Up @@ -171,6 +175,12 @@ def get_rich_item(self, item):
if "__text__" in issue["summary"][0]:
eitem["summary"] = issue['summary'][0]['__text__'][:self.KEYWORD_MAX_LENGTH]
eitem["summary_analyzed"] = issue['summary'][0]['__text__']
try:
eitem['description'] = issue['long_desc'][0]['thetext'][0]['__text__'][:self.KEYWORD_MAX_LENGTH]
eitem['description_analyzed'] = issue['long_desc'][0]['thetext'][0]['__text__']
except (KeyError, IndexError):
eitem['description'] = ""
eitem['description_analyzed'] = ""

# Fix dates
date_ts = str_to_datetime(issue['delta_ts'][0]['__text__'])
Expand Down
9 changes: 9 additions & 0 deletions releases/unreleased/bug-description-in-bugzilla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Bug description in Bugzilla
category: added
author: Jose Javier Merchante <jjmerchante@bitergia.com>
issue: null
notes: >
Include the description of the bugs in Bugzilla. The new fields
are 'description' and 'description_analyzed'. The second allows
to query any of the words of the description.
2 changes: 2 additions & 0 deletions schema/bugzilla.csv
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ creator_detail_org_name,keyword
creator_detail_user_name,keyword
creator_detail_uuid,keyword
delta_ts,date
description,keyword
description_analyzed,string
grimoire_creation_date,date
id,long
is_bugzilla_bug,long
Expand Down
4 changes: 4 additions & 0 deletions tests/test_bugzilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ def test_raw_to_enrich(self):
eitem = enrich_backend.get_rich_item(item)
self.assertIn('main_description', eitem)
self.assertIn('main_description_analyzed', eitem)
self.assertIn('description', eitem)
self.assertIn('description_analyzed', eitem)
self.assertRegex(eitem['description'], "Lorem ipsum dolor.*")
self.assertRegex(eitem['description_analyzed'], "Lorem ipsum dolor.*")

def test_enrich_repo_labels(self):
"""Test whether the field REPO_LABELS is present in the enriched items"""
Expand Down

0 comments on commit 117e2e3

Please sign in to comment.