Make the search more flexible
This commit is contained in:
parent
424f8381d3
commit
aec3e2c408
|
@ -29,9 +29,29 @@ def construct_query(query, fields, results):
|
||||||
query = {
|
query = {
|
||||||
"size": results,
|
"size": results,
|
||||||
"query": {
|
"query": {
|
||||||
"multi_match": {
|
"query_string": {
|
||||||
"query": query,
|
"query": query,
|
||||||
"fields": fields,
|
"fields": fields,
|
||||||
|
# "default_field": "msg",
|
||||||
|
# "type": "best_fields",
|
||||||
|
"fuzziness": "AUTO",
|
||||||
|
"fuzzy_transpositions": True,
|
||||||
|
"fuzzy_max_expansions": 50,
|
||||||
|
"fuzzy_prefix_length": 0,
|
||||||
|
"minimum_should_match": 1,
|
||||||
|
"default_operator": "or",
|
||||||
|
"analyzer": "standard",
|
||||||
|
"lenient": False,
|
||||||
|
"boost": 1,
|
||||||
|
"allow_leading_wildcard": True,
|
||||||
|
"enable_position_increments": False,
|
||||||
|
"phrase_slop": 3,
|
||||||
|
"max_determinized_states": 10000,
|
||||||
|
"time_zone": "-08:00",
|
||||||
|
"quote_field_suffix": "",
|
||||||
|
"quote_analyzer": "standard",
|
||||||
|
"analyze_wildcard": True,
|
||||||
|
"auto_generate_synonyms_phrase_query": True,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,5 +142,6 @@
|
||||||
</div>
|
</div>
|
||||||
{% if results is not None %}
|
{% if results is not None %}
|
||||||
<p>{{ card }} hits</p>
|
<p>{{ card }} hits</p>
|
||||||
|
<p>{{ took }}ms</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -46,6 +46,7 @@ class Drilldown(LoginRequiredMixin, View):
|
||||||
"query": query,
|
"query": query,
|
||||||
"results": results_parsed,
|
"results": results_parsed,
|
||||||
"card": results["hits"]["total"]["value"],
|
"card": results["hits"]["total"]["value"],
|
||||||
|
"took": results["took"],
|
||||||
"fields": settings.OPENSEARCH_MAIN_SEARCH_FIELDS,
|
"fields": settings.OPENSEARCH_MAIN_SEARCH_FIELDS,
|
||||||
}
|
}
|
||||||
return render(request, self.template_name, context)
|
return render(request, self.template_name, context)
|
||||||
|
|
Loading…
Reference in New Issue