Configuring search components

Recommendations for the basic configuration for the Search Handler, and an example that shows adding a search component.

The wikipedia demo solrconfig.xml configures the Search Handler as follows:
<requestHandler name="search" class="solr.SearchHandler" default="true">

DataStax recommends using this basic configuration for the Search Handler.

Configuring additional search components

To configure the search handler for managing additional search components, you generally need to add the additional component to the array of last-components to preserve the default configured components. Distributed search does not work properly if you fail to preserve the default configured components. Unless otherwise specified in Solr documentation, declare the additional component as described in the following example.

How to add a search component

This example shows the configuration of an additional search component for spellchecking and how to add that component to the last-components array of the search handler. The additional component specifies the Java spelling checking package JaSpell:

Component configuration

<searchComponent class="solr.SpellCheckComponent" name="suggest_jaspell">
    <lst name="spellchecker">
      <str name="name">suggest</str>
      <str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
      <str name="lookupImpl">org.apache.solr.spelling.suggest.jaspell.JaspellLookup</str>
      <str name="field">suggest</str>
      <str name="storeDir">suggest</str>
      <str name="buildOnCommit">true</str>
      <float name="threshold">0.0</float>

To add the spell check component to the last-components array:

Last-components declaration

<requestHandler class="org.apache.solr.handler.component.SearchHandler" name="/suggest">
    <lst name="defaults">
      <str name="spellcheck">true</str>
      <str name="spellcheck.dictionary">suggest</str>
      <str name="spellcheck.collate">true</str>
      <str name="spellcheck.extendedResults">true</str>
    <arr name="last-components">