Advanced Search Using HayStack + Solr in Django?

I tried the basic tutorial presented on the Haystack website http://django-haystack.readthedocs.org/en/latest/tutorial.html and its working tone for the main search. But the search is not efficient, since my Note module has 3 entries for the text field.

  • Twitter Bootstrap Designer for Designing / Editing a Website Theme
  • Django application (python) using mod_wsgi, virtualenv, on Ubuntu
  • The Python exam will take place in Rajasthan.

When i'm looking

python Result: text box 2 and 3 .

python exam result: 3 text box

but looking for python flask fails. I want to get the 2nd and 3rd result again since there is a python keyword.

when searching for boot there is no result, but it should show the 1st result, it has boot in the word bootstrap .

when searching for pyton , there is no result again, but it should show the results of the 2nd and 3rd , since it is missing only <char h in python .

when searching for bootstrap django again there is no result, but it should show the results of the 1st and 2nd .

So it looks like I'm missing some additional haystack settings.

How can I make it a more effective search so that it gives better results, and not just direct comparison?

+4
source share
1 answer

I answered your various questions as inline answers.

but searching in python flask fails. I want the 2nd and 3rd result again, since there is a python keyword.

You want to change the hay operator from AND to OR . See http://django-haystack.readthedocs.org/en/v2.1.0/settings.html#haystack-default-operator for details.

when searching, there is no result, but it should show the 1st result, it will boot in the word bootstrap.

Take a look at NgramField and EdgeNgramField for partial matching.

when the pyton search again fails, but it should show the 2nd and 3rd result, since this is just 1 char h missing in python.

Look at the options gland spelling: http://django-haystack.readthedocs.org/en/latest/searchqueryset_api.html#spelling-suggestion

when searching for bootstrap django again there is no result, but it should show the 1st and 2nd result.

This is configured by the haystack operator.


Configuration example for Haystack 2.0+ with the default statement set to OR and INCLUDE_SPELLING=True

 HAYSTACK_CONNECTIONS = { 'default': { 'ENGINE': 'haystack.backends.solr_backend.SolrEngine', 'URL': 'http://localhost:9001/solr/default', 'INCLUDE_SPELLING': True, }, } HAYSTACK_DEFAULT_OPERATOR = 'OR' 
+6
source

Source: https://habr.com/ru/post/1496378/


All Articles