views:

338

answers:

2

During development I used whoosh as a backend, and now 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 with Failed to add documents to Solr: [Reason: None] .

All searches are also wrong with 0 results returned for all queries.. This work if I change to whoosh. However, I have a RealTimeSearch index set, and during model creation I am getting no warning about not being able to write to search index. (From which I am assuming that data is being correctly being written to solr index.

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

+3  A: 

This error usually happens when your schema.xml file is improperly configured.

You can use python manage.py build_solr_schema > schema.xml to generate the schema.

In order to actually have solr use it, you typically place it in example/solr/conf/schema.xml

Finally: watch the log output of your Solr server. During development I have it running via java -jar start.jar and it implicitly prints to my screen. Otherwise, your logs go into the example/logs directory.

As Per Comments:

Double check the HAYSTACK_SOLR_URL It should not have a trailing slash.

Koobz
This is happening after I have copied the schema.xml over to example/solr/conf/schema.xml. The result I get on `rebuild_index` is http://dpaste.de/vOkU/
uswaretech
Also looks like if it is not even hitting Solr as the console started has no new logs
uswaretech
Yes, the 404 not found suggests the url is wrong.Double check your HAYSTACK_SOLR_URL perhaps? Mine looks like: http://localhost:8983/solr
Koobz
Thanks that fixed it. Had set the url to localhost:8983
uswaretech
A: 

I was having this error. The first reason was that I hadn't rebuilt the schema.xml, but there is something more... After you rebuild the schema.xml you must to restart Solr. Doing this, Solr will recognize the schema changes and will know the new fields.

Harph