Skip to content

Commit 21e12f9

Browse files
author
Murat Kumykov
committed
alias matching added
1 parent 02adb4a commit 21e12f9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/bom_add_kb_components_from_list.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ def find_kb_component(component_name):
6060
hit_counts = dict()
6161
for item in items:
6262
for hit in item['hits']:
63-
if component_name.strip() in hit['fields']['name']:
63+
aliases = hit.get('fields').get('aliases', None)
64+
if aliases and component_name.strip() in aliases:
65+
hit_counts[hit['_meta']['href']] = hit['fields']['release_count']
66+
elif component_name.strip() in hit['fields']['name']:
6467
hit_counts[hit['_meta']['href']] = hit['fields']['release_count']
6568
return hit_counts
6669

0 commit comments

Comments
 (0)