Hi all,

Someone posted this problem over a year ago but I did not see a clear
resolution in the thread.

Intermittently--i.e. for some searches, not others--the
'suggest/spellcheck' component throws a n NullPointerException (NPE) when a
user executes  a search. It fails on  FSTCompletionLookup (line 244)

I'm using solr 4.4. ( I'm using 4.4 to match "what's in production")I could
upgrade if necessary. )

Any hints on why it occurs and how to fix? The earlier post alluded to
"changing the field type solved the problem", but did not provide details.

Thanks

will

/select request handler:
========================

       <str name="spellcheck">on</str>
      <str name="spellcheck.dictionary">suggestDictionary</str>
      <str name="spellcheck.extendedResults">false</str>
      <str name="spellcheck.count">5</str>
      <str name="spellcheck.alternativeTermCount">2</str>
      <str name="spellcheck.maxResultsForSuggest">5</str>
      <str name="spellcheck.collate">true</str>
      <str name="spellcheck.collateExtendedResults">true</str>
      <str name="spellcheck.maxCollationTries">5</str>
      <str name="spellcheck.maxCollations">3</str>

spellcheck component:
========================

    <searchComponent class="solr.SpellCheckComponent" name="suggest">
        <lst name="spellchecker">
            <str name="name">suggestDictionary</str>
            <str
name="classname">org.apache.solr.spelling.suggest.Suggester</str>
            <str
name="lookupImpl">org.apache.solr.spelling.suggest.fst.FSTLookupFactory</str>
            <str name="field">title</str>
         <!--   <str name="field">suggest</str> -->
            <float name="threshold">0.</float>
            <str name="buildOnCommit">true</str>
        </lst>
    </searchComponent>

field type definition:
========================

    <fieldType name="text_general" class="solr.TextField"
positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <!-- Use EdgeNGramFilter for wildcard search -->
        <filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt" />
        <!-- in this example, we will only use synonyms at query time
        <filter class="solr.SynonymFilterFactory"
synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
        -->
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt" />
        <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
ignoreCase="true" expand="true"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
    </fieldType>

field definition:
========================

    <field name="title" type="text_general" indexed="true" stored="true"
multiValued="false" omitNorms="false"/>

It fails here:
===============
Here's the line that fails.

@Override
  public List<LookupResult> lookup(CharSequence key, boolean
higherWeightsFirst, int num) {
    final List<Completion> completions;
    if (higherWeightsFirst) {
      completions = higherWeightsCompletion.lookup(key, num);
    } else {
      completions = normalCompletion.lookup(key, num); <-- fails on this
line

    }

Reply via email to