divio / aldryn-search

Haystack 2.0 search index for django CMS
Other
48 stars 77 forks source link

Results are incorrect #108

Open svandeneertwegh opened 3 years ago

svandeneertwegh commented 3 years ago

Hello,

I have elasticsearch 2.4 setup active with pip package elasticsearch2.4 within my django-cms project.

Haystack setup is this;

` HAYSTACK_CONNECTIONS = { 'default': { 'ENGINE': 'haystack.backends.elasticsearch2_backend.Elasticsearch2SearchEngine', 'URL': 'http://192.168.1.19:9200/', 'INDEX_NAME': 'haystack', }, 'nl': { 'ENGINE': 'haystack.backends.elasticsearch2_backend.Elasticsearch2SearchEngine', 'URL': 'http://192.168.1.19:9200/', 'INDEX_NAME': 'haystack-nl', 'TIMEOUT': 60 5, 'INCLUDE_SPELLING': True, 'BATCH_SIZE': 100, }, 'en': { 'ENGINE': 'haystack.backends.elasticsearch2_backend.Elasticsearch2SearchEngine', 'URL': 'http://192.168.1.19:9200/', 'INDEX_NAME': 'haystack-en', 'TIMEOUT': 60 5, 'INCLUDE_SPELLING': True, 'BATCH_SIZE': 100, }, 'fr': { 'ENGINE': 'haystack.backends.elasticsearch2_backend.Elasticsearch2SearchEngine', 'URL': 'http://192.168.1.19:9200/', 'INDEX_NAME': 'haystack-fr', 'TIMEOUT': 60 * 5, 'INCLUDE_SPELLING': True, 'BATCH_SIZE': 100, }, }

HAYSTACK_ROUTERS = ['aldryn_search.router.LanguageRouter',] `

manage.py rebuild_index and update_index works.

But the problem is my results are not showing or are showing for wrong language. Also it finds a blog article for english but it shows the title from nl from the blog article.

Had anyone also problems with the search? Or is there a place where i can have support?

svandeneertwegh commented 3 years ago

Or has it something to do with the djangocms-cascade plugins who i believe are saved in jsonfield?

benzkji commented 3 years ago

the jsonfield is probably not a problem, plugins are rendered for the index. I have it working, but with woosh. also. one thing after another - blog articles might not be indexed correctly (the api, with inheritance, is a bit tricky and took me some time to learn).

one thing that helped me, is playing with the SearchQuerySet in the django shell: https://django-haystack.readthedocs.io/en/master/searchqueryset_api.html and try to search only in pages, or only in blogs...