Solr-5-for-django-haystack
Solr-5-for-django-haystack copied to clipboard
Issue with managed_schema
I'm running solr 5.5 on OSX (installed via brew) and I noticed the following error when trying to build my initial index:
Failed to add documents to Solr: Solr responded with an error (HTTP 400): [Reason: ERROR: [doc=pub.pub.1] unknown field 'django_ct']
Traceback (most recent call last):
File "/Users/timmyomahony/Development/Sites/pubswith.com/lib/python2.7/site-packages/haystack/backends/solr_backend.py", line 72, in update
self.conn.add(docs, commit=commit, boost=index.get_field_weights())
File "/Users/timmyomahony/Development/Sites/pubswith.com/lib/python2.7/site-packages/pysolr.py", line 860, in add
return self._update(m, commit=commit, softCommit=softCommit, waitFlush=waitFlush, waitSearcher=waitSearcher)
File "/Users/timmyomahony/Development/Sites/pubswith.com/lib/python2.7/site-packages/pysolr.py", line 462, in _update
return self._send_request('post', path, message, {'Content-type': 'text/xml; charset=utf-8'})
File "/Users/timmyomahony/Development/Sites/pubswith.com/lib/python2.7/site-packages/pysolr.py", line 394, in _send_request
raise SolrError(error_message % (resp.status_code, solr_message))
SolrError: Solr responded with an error (HTTP 400): [Reason: ERROR: [doc=pub.pub.1] unknown field 'django_ct']
It seems that there is a new "managed schema" feature being introduced. I'm not sure exactly what the implication of this is (it seems to allow the modification of schemas through an API) but it needs to be disabled, otherwise the regular schema.xml
will not be detected, causing the above error.
To disable, open the solr config /usr/local/Cellar/solr/5.5.0/server/solr/MYCORE/conf/solrconfig.xml
and remove the following:
<!--
...
-->
<schemaFactory class="ManagedIndexSchemaFactory">
<bool name="mutable">true</bool>
<str name="managedSchemaResourceName">managed-schema</str>
</schemaFactory>
Alternatively, I think you can just replace it with:
<schemaFactory class="ManagedIndexSchemaFactory">
I also deleted the "managed schema" config file:
rm -r /usr/local/Cellar/solr/5.5.0/server/solr/MYCORE/conf/managed-schema
Thanks for this info. So would you suggest adding your message's text that begins at "It seems that there is a new "managed schema" feature being introduced..." and so on to the readme of this repo? I can't test 5.5 myself at the moment.
See: https://cwiki.apache.org/confluence/display/solr/Schema+Factory+Definition+in+SolrConfig
At least with Solr 6, I found it necessary to explicitly put
<schemaFactory class="ClassicIndexSchemaFactory"/>
Im on Solr 6 and having the exact same problem with 'list' object has no attribute 'split' when I try to view search results in local browser as posted here last year:
https://github.com/django-haystack/django-haystack/issues/1182
I tried adding the 'schemaFactory' line to solrconfig.xml but it hasn't done anything, is there a particular location in the file that line should go?
edit: I should add that I had already renamed 'managed-schema' to schema.xml, I built the index ok too (or I think I have)
edit2: ok forgot to reload the core, that didn't work either so restarted solr and I seem to be getting my search results back in local browser now