0π
As @Val has stated in the above answer, the error was because search_analyzer and indexed_analyzer are same which caused the issue,
As we all know haystack
is very inflexible in setting up the basic elasticsearch configuration, I installed elasticstack and in my setting.py changed the backend to itβs elasticsearch_backend
as suggest and additionally added the following 2 configurations
# elasticslack setting
ELASTICSEARCH_DEFAULT_ANALYZER = 'snowball'
ELASTICSEARCH_DEFAULT_NGRAM_SEARCH_ANALYZER = 'standard'
this seemed to solve my problem.
1π
It seems to be related to this open issue
This is because your search_auto
ngram field has the same index and search analyzer and hence your search term pondicherry
also gets ngramed at search time. The only way to fix this is to set a different search_analyzer
for your search_auto
field, standard
would be a good fit.
You can change your search_auto
field mapping with this:
curl -XPUT localhost:9200/haystack/_mapping/modelresult -d '{
"properties": {
"search_auto": {
"type": "string",
"analyzer": "ngram_analyzer",
"search_analyzer": "standard"
}
}
}'
- How to use react build websites without using react-router ?
- Creating users with custom attributes: the post_save signal seems not to be received
- How to print meaningfull error messages to the user through JsonResponse and Django
- <h1> styling not working but others will