You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "Giannone, David" <Da...@ONSTAR.com> on 2012/11/24 18:29:30 UTC

Configuring multiple spell checkers

Hi all,

I'm trying to configure our Solr 3.4 deployment to have multiple
spellcheckers based on 2 different fields, one in English and one in
Spanish.   In solrconfig.xml, the SpellCheckComponent requires a
queryAnalyzerFieldType and each of these fields is based on a different
field type for language specific synonym and stop files and stemmer
language property.     I created two SpellCheckComponent entries as
described below (one for English and one for Spanish).   I then added
each of these components to the lastComponents array of the search
handler.   This configuration always results in a nullpointerexception
when spellcheck=true.    I had planned to use the spellcheck.dictionary
parameter in my search requests to select the appropriate spellchecker
for each request.   I haven't hit on the correct configuration to get
this working.    Can this be done in Solr 3.4 and if so, what is the
configuration required?    Any help is much appreciated.

Thanks,
David Giannone


  <searchComponent name="spellcheck" class="solr.SpellCheckComponent">

    <str name="queryAnalyzerFieldType">textSpell</str>

    <!-- Multiple "Spell Checkers" can be declared and used by this
         component
      -->

    <!-- a spellchecker built from a field of the main index, and
         written to disk
      -->
    <lst name="spellchecker">
      <str name="name">default</str>
      <str name="field">NAME_SPELL</str>
      <str name="buildOnOptimize">true</str>
      <str name="spellcheckIndexDir">./spellchecker_name_spell_en</str>
      <str name="accuracy">0.7</str>
      <!--<float name="thresholdTokenFrequency">.0001</float>-->
      <!-- uncomment this to require terms to occur in 1% of the
documents in order to be included in the dictionary
        <float name="thresholdTokenFrequency">.01</float>
      -->
    </lst>
  </searchComponent>


  <searchComponent name="spellcheck_es"
class="solr.SpellCheckComponent">

    <str name="queryAnalyzerFieldType">textSpell_es</str>

    <!-- Multiple "Spell Checkers" can be declared and used by this
     component
      -->

    <!-- a spellchecker built from a field of the main index, and
         written to disk
      -->
    <lst name="spellchecker">
      <str name="name">spellcheck_es</str>
      <str name="field">NAME_SPELL_es</str>
      <str name="buildOnOptimize">true</str>
      <str name="spellcheckIndexDir">./spellchecker_name_spell_es</str>
      <str name="accuracy">0.7</str>
      <!--<float name="thresholdTokenFrequency">.0001</float>-->
      <!-- uncomment this to require terms to occur in 1% of the
documents in order to be included in the dictionary
        <float name="thresholdTokenFrequency">.01</float>
      -->
    </lst>
  </searchComponent>