Commit f7971fb9 authored by Samuel Trégouët's avatar Samuel Trégouët
Browse files

[es6] remove `_all` field in search_helpers

this magic field does not exist anymore with elasticsearch 6
use computed field which it is named `alltext` by convention
parent 1d0ff3bd0daf
......@@ -37,7 +37,7 @@ def compose_search(search, query=None, fields=(),
query:
text of the query to be composed (can contain quotes)
fields:
restrict and boost search on certain fields eg. ('title^2', '_all')
restrict and boost search on certain fields eg. ('title^2', 'alltext')
fuzzy:
add a fuzzy search element to part of the query generated
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-fuzzy-query.html
......@@ -73,12 +73,12 @@ def compose_search(search, query=None, fields=(),
# highfrequency/lowfrequency query
# https://www.elastic.co/blog/stop-stopping-stop-words-a-look-at-common-terms-query
if common:
common_query = dsl_query.Common(_all={"query": query,
"cutoff_frequency": cutoff_frequency,
"low_freq_operator": "and",
"minimum_should_match": {
"high_freq": "70%"
}})
common_query = dsl_query.Common(alltext={"query": query,
"cutoff_frequency": cutoff_frequency,
"low_freq_operator": "and",
"minimum_should_match": {
"high_freq": "70%"
}})
should.append(common_query)
elements = query.split()
......@@ -97,7 +97,7 @@ def compose_search(search, query=None, fields=(),
else:
if fuzzy:
should.append(dsl_query.Fuzzy(_all=element))
should.append(dsl_query.Fuzzy(alltext=element))
bool_query = dsl_query.Bool(must=must,
must_not=must_not,
should=should,
......
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