Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ChEMBL
C
ChEMBL
Main Web Interface
Elasticsearch Proxy API
Commits
638dd0e1
Commit
638dd0e1
authored
Oct 04, 2021
by
David Mendez
Browse files
Eubopen search: do not fail if term is ''
parent
106a70a7
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
app/blueprints/eubopen/search/controller.py
app/blueprints/eubopen/search/controller.py
+4
-2
app/eubopen/search/suggestions/suggestions.py
app/eubopen/search/suggestions/suggestions.py
+5
-0
No files found.
app/blueprints/eubopen/search/controller.py
View file @
638dd0e1
...
...
@@ -18,7 +18,8 @@ def get_autocomplete_results():
:return: the results for the autocomplete query
"""
form_data
=
request
.
form
term
=
form_data
.
get
(
'term'
)
raw_term
=
form_data
.
get
(
'term'
,
'*'
)
term
=
'*'
if
raw_term
==
''
else
raw_term
json_data
=
services
.
get_autocomplete_results
(
term
)
http_response
=
http_cache_utils
.
get_json_response_with_http_cache_headers
(
json_data
)
...
...
@@ -32,5 +33,6 @@ def get_free_text_search_queries():
:return: the queries corresponding to the search term
"""
form_data
=
request
.
form
term
=
form_data
.
get
(
'term'
)
raw_term
=
form_data
.
get
(
'term'
,
'*'
)
term
=
'*'
if
raw_term
==
''
else
raw_term
return
services
.
get_search_results
(
term
)
app/eubopen/search/suggestions/suggestions.py
View file @
638dd0e1
...
...
@@ -4,10 +4,15 @@ Module with the functions to generate suggestions for eubopen
from
app.es_data
import
es_data
from
app.config
import
RUN_CONFIG
from
app.properties_configuration
import
properties_configuration_manager
from
app.cache.decorators
import
return_if_cached_results
from
utils
import
dict_property_access
@
return_if_cached_results
({
'cache_key_generator'
:
lambda
*
args
,
**
kwargs
:
f
'EUbOPEN-search-suggestion-
{
args
[
0
]
}
'
,
'timeout'
:
RUN_CONFIG
.
get
(
'es_proxy_cache_seconds'
)
})
def
get_suggestions_for_term
(
term
):
"""
:param term: term for which to do the suggestion
...
...
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