Solr Setup with Search API Drupal Module - pulibrary/pul_library_drupal GitHub Wiki

Install Solr

  1. Download Most Recent Solr
  2. Unpack to a directory on the local machine

Configure Solr Multi-Core

  1. Cd to {solr_install}/example/solr
  2. Edit to solr.xml to have a core that can hold indexes for the site to look something like this. Right now the name of the index for the core site is sapilibrary-stage with configs for it living in the subdirectory sapilibrary_stage in {solr_install}/example/solr
<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" host="${host:}" hostPort="${jetty.port:8983}" hostContext="${hostContext:solr}">
    <core name="core0" instanceDir="core0" />
    <core name="core1" instanceDir="core1" />
    <core name="sapilibrary_stage" instanceDir="sapilibrary-stage" />
  </cores>
</solr>

Copy Drupal Search API Solr Schema to Solr Core Conf

  1. Search API module consists of various submodules. You will find the current recommended solr conf in the "search_api_solr" module directory. Change to {DRUPAL_ROOT}/sites/all/modules/search_api_solr/solr-conf/4.x.
  2. Copy all files in that directory to {solr_install}/example/solr/sapilibrary-stage/conf/

FYI: The {solr_install} directory on PUL servers is typically /opt/solr/.

Start Solr

To restart Solr, all that is needed is: sudo service jetty start

Check Index Status With Drush

  1. cd {DRUPAL_ROOT}
  2. run drush sapi-s you should see something like:
 Id  Index                          % Complete  Indexed  Total 
 10  Best Database Bet              99.1%       5460     5508  
 11  Database Keyword Index         99.1%       5460     5508  
 12  Database Subject Index         93.1%       2879     3091  
 13  Databases URI                  99.1%       5460     5508  
 14  Default node index             99.1%       5460     5508  
 15  Database Administrative Index  99.1%       5460     5508  
 16  Libraries and Collections      99.1%       5460     5508  
 17  Staff User Index               99.6%       500      502
  1. Rebuild Indexes. Run drush sapi-c to clear all Indexes
  2. Now Rebuild them. Run drush sapi-i {index_id_number} for each index.
  3. Check Search API Configuration to see how they are defined. See http://{my-local-site}/admin/config/search/search_api
⚠️ **GitHub.com Fallback** ⚠️