Skip to content

Commit

Permalink
Display es scores (#199)
Browse files Browse the repository at this point in the history
* Include ES scores in variable results

* Round ES score to 6
  • Loading branch information
gingin77 authored Feb 8, 2022
1 parent d0d5814 commit a66ca59
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/dug/core/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,13 +411,13 @@ def search_variables(self, index, concept="", query="", size=None, data_type=Non
"identifiers": concept
}
}

body = json.dumps({'query': query})
total_items = self.es.count(body=body, index=index)
search_results = self.es.search(
index=index,
body=body,
filter_path=['hits.hits._id', 'hits.hits._type', 'hits.hits._source'],
filter_path=['hits.hits._id', 'hits.hits._type', 'hits.hits._source', 'hits.hits._score'],
from_=offset,
size=size
)
Expand All @@ -441,7 +441,8 @@ def search_variables(self, index, concept="", query="", size=None, data_type=Non
"description": elem_s['element_desc'],
"e_link": elem_s['element_action'],
"id": elem_id,
"name": elem_s['element_name']
"name": elem_s['element_name'],
"score": round(elem['_score'], 6)
}

# Case: collection not in dictionary for given data_type
Expand Down

0 comments on commit a66ca59

Please sign in to comment.