def autocomplete_queries(self, query_string):
"""provide autocomplete suggestions"""
analyzer = InputQAnalyzer(query_string)
query_components = [
vestiging_query(analyzer),
mac_query(analyzer)
]
result_data = []
# Ignoring cache in case debug is on
ignore_cache = settings.TESTING
# create elk queries
for q in query_components: # type: ElasticQueryWrapper
search = q.to_elasticsearch_object(self.client)
# get the result from elastic
try:
result = search.execute(ignore_cache=ignore_cache)
except:
log.exception('FAILED ELK SEARCH: %s',
json.dumps(search.to_dict(), indent=2))
continue
# Get the datas!
result_data.append(result)
return result_data
评论列表
文章目录