Installing Django1.5-Haystack-2.0.0-beta with Solr-4.2.1

Install Haystack with his dependency pysolr

pysolr==3.0.6
django-haystack==2.0.0-beta

Install the solr-4.2.1 by following the steps

https://django-haystack.readthedocs.org/en/latest/installingsearchengines.html#solr

Follow the tutorial to configure haystack

http://django-haystack.readthedocs.org/en/latest/tutorial.html

Configuring Solr-4.2.1

  • Use the command build_solr_schema to generate the schema.xml file

  • Copy the schema.xml file to the following directory

    `solr-4.2.1/example/solr/collection1/conf/

    NOTE: The conf directory changed in this version

  • Add the following line in the section in the schema.xml

....
<field name="_version_" type="long" indexed="true" stored ="true"/>
....
Otherwise, the following exception will be thrown
Caused by: org.apache.solr.common.SolrException: _version_field must exist in schema, 
using indexed="true" stored="true" and multiValued="false" (_version_ does not exist)
  • Update the stopwordsen.txt path in the schema.xml to “lang/stopwordsen.txt”

    Otherwise, the following exception will be thrown

java.io.IOException: Can't find resource 'stopwords_en.txt' in classpath 
or 'solr/collection1/conf/', cwd=solr/solr-4.2.1/example`
This entry was posted in Django and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *