Django: questions about using Solr and Haystack

So, I did pip install django-haystack or something like a command in my project virtualenv folder, and I also have solr, but now I'm a bit confused as to what to do.

Am I always mistaken in saying that installing pysolr is required to support solr? and I'm confused, where am I running this command? "./manage.py build_solr_schema"

I tried to reference the hay guide, but it is a bit vague. Help me please!! Thanks

+4
source share
1 answer

Suppose you have Solr 4.10.4 , and you use the example directory , which contains the ready-made Solr configuration.

To install haystack, if you are using virtualenv, you first activate it and then run

pip install django-haystack

and use the Solr backend , you also need to install the module pysolrin your virtual

pip install pysolr

To add a haystack file to INSTALLED_APPSin settings.py

INSTALLED_APPS = (
    # ...
    'haystack',
)

And you need to set in settings.py ifle - the search engine backend to use the haystack:

HAYSTACK_CONNECTIONS = {
    'default': {
    'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
    'URL': 'http://127.0.0.1:8983/solr/the_core_you_created'
   },
}

the_core_you_createdis the Solr core that you created for your application.

, , , serach, SearchIndexes. , , , :

python manage.py build_solr_schema

solr/the_core_you_created/conf/schema.xml

:

python manage.py rebuild_index

.

haystack docs - - Django .

+1

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


All Articles