[Django]-Can't build index for solr/haystack: unknown field 'django_id'

10👍

The problem is with the Solr (haystack document use v3.5.0, here you may be using the latest) not finding the configuration file. These 3 steps worked for me

  • Place the schema in solr-x.y.z/example/solr/collection1/conf/schema.xml

  • In the schema change stopwords_en.txt to lang/stopwords_en.txt

  • Add the version field (as mentioned below) to the schema in the fields section

    <field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>
    

For more information check out the same discussion in GitHub

👤NEB

5👍

This is more of a comment, but due to my lack of points I am unable to comment…

Has anyone figure out a soltuion to this? I’m having the exact same problem. The field is being created in schema.xml as such:

<field name="django_id" type="string" indexed="true" stored="true" multiValued="false"/>

I have restarted Solr (multiple times), and I am 100% positive my schema.xml code is correct. What the heck is going on here?

EDIT: I switched to Elasticsearch and have no problems. However, I’m sure others out there would find help to this question useful.

1👍

I had to clone the haystack source code and do some hacks as follows :

In the /haystack/management/commands/build_solr_schema.py , I commented DJANGO_ID in the build_context() func.
Then in /haystack/templates/search_configuration/solr.xml , I replaced {{ DJANGO_ID }} with "django_id" and everything worked ok.

I think the {{DJANGO_ID}} is not being replaced with "django_id" when you generate schema.xml.

👤Liyosi

Leave a comment