Tuesday, August 21, 2012

Configuring Drupal search_api_solr module

In my previous post I described in detail how to set up Solr.
In order to install Drupal search_api_solr we need to install the module using Drush or some other way.
After installation is complete, we need to move schema.xml and solrconfig.xml from module to solr.
We define Solr cores in solr.xml on the Solr root /var/solr in our case.
Sample configuration is:
<?xml version="1.0" encoding="UTF-8" ?>

<solr persistent="false">

  adminPath: RequestHandler path to manage cores.  
    If 'null' (or absent), cores will not be manageable via request handler
  <cores adminPath="/admin/cores" defaultCoreName="core0">
    <core name="core0" instanceDir="core0" />

Now we move schema.xml and solrconfig.xml from module to solr.
cp module_installation_folder/search_api_solr/schema.xml /var/solr/core0/conf/.
cp module_installation_folder/search_api_solr/solrconfig.xml /var/solr/core0/conf/.
If we check schema.xml we will see that we also need to define /var/solr/core0/conf/protwords.txt
and we must download mapping-ISOLatin1Accent.txt to map non ascii chars to their ASCII equivalent.
In Drupal go to http://localhost/admin/config/search/search_api/server/solr_server/edit to tell Drupal where your Solr is.
You can test your installation by visiting http://locahost:8983/solr/ as we defined it in Tomcat context as described in previous post.
All we need now is to fill Solr with data using drush sapi-i command (thanks Gasper for help).
Post a Comment