Commit 056c747f authored by Carina Antunes's avatar Carina Antunes
Browse files

improve score calcs

parent 55e48704
...@@ -81,10 +81,19 @@ def search_factory(self, search, query_parser=None): ...@@ -81,10 +81,19 @@ def search_factory(self, search, query_parser=None):
def _csas_query_parser(qstr=None): def _csas_query_parser(qstr=None):
"""Default parser that uses the Q() from elasticsearch_dsl.""" """Default parser that uses the Q() from elasticsearch_dsl."""
if qstr: if qstr:
return Q('query_string', query=qstr, default_field='_data.*') return Q(
'query_string',
query=qstr,
default_field='_data.*',
rewrite="scoring_boolean" # calculates score for wildcards queries
)
return Q() return Q()
return default_search_factory(self, search, _csas_query_parser) search, urlkwargs = default_search_factory(self, search, _csas_query_parser) # type: RecordCERNSearch, MultiDict
search = search.params(search_type="dfs_query_then_fetch") # search across all shards
return search, urlkwargs
csas_search_factory = search_factory csas_search_factory = search_factory
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment