Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
webservices
cern-search
cern-search-rest-api
Commits
056c747f
Commit
056c747f
authored
Apr 03, 2020
by
Carina Antunes
Browse files
improve score calcs
parent
55e48704
Changes
1
Hide whitespace changes
Inline
Side-by-side
cern_search_rest_api/modules/cernsearch/search.py
View file @
056c747f
...
...
@@ -81,10 +81,19 @@ def search_factory(self, search, query_parser=None):
def
_csas_query_parser
(
qstr
=
None
):
"""Default parser that uses the Q() from elasticsearch_dsl."""
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
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment