Commit 638dd0e1 authored by David Mendez's avatar David Mendez
Browse files

Eubopen search: do not fail if term is ''

parent 106a70a7
......@@ -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)
......@@ -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
......
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