Django columns do not add to the Solr index. [Works with whoosh, fails with Solr]

During development, I used whoosh as a backend, and now I want to switch to Solr. I installed solr, changed the settings to HAYSTACK_SEARCH_ENGINE and HAYSTACK_SOLR_URL.

Now when I try to update or rebuild the index, it fails Failed to add documents to Solr: [Reason: None]  .

All search queries are also invalid with 0 results returned for all queries. This work, if I switch to a whistle. However, I have a RealTimeSearch index, and during model creation I do not warn about the lack of the ability to write to the search index. (From which I assume that the data is correctly written to the solr index.

I see that solr works by going directly to the port where solr is running.

+3
source share
2 answers

This error usually occurs when the schema.xml file is not configured correctly.

You can use python manage.py build_solr_schema > schema.xmlto create a diagram.

To actually use solr, you usually put it in example/solr/conf/schema.xml

Finally: view the log output of your Solr server. During development, I run it through java -jar start.jar, and it implicitly prints on my screen. Otherwise, your logs will go to the directory example/logs.


Also double check HAYSTACK_SOLR_URL. It should not have a slash.

+11
source

. , schema.xml, - ... , schema.xml, Solr. , Solr .

+4

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


All Articles