solr suggester not returning any results

A couple of things I can think of that might cause this problem:

  • The source field (“description”) is incorrect – ensure that this is indeed the field that seeds terms for your spell checker. It could even be that the field is a different case (eg. “Description” instead of “description”).

  • The source field in your schema.xml is not set up correctly or is being processed by filters that cause the source dictionary to be invalid. I use a separate field to seed the dictionary, and use <copyfield /> to copy relevant other fields to that.

  • The term “barbeque” doesn’t appear in at least 5% of records (you’ve indicated this requirement by including <float name="threshold">0.05</float>) and therefore is not included in the lookup dictionary

  • In SpellCheckComponent the <str name="spellcheck.onlyMorePopular">true</str> setting means that only terms that would produce more results are returned as suggestions. According to the Suggester documentation this has a different function (sorting suggestions by weight) but it might be worth switching this to false to see if it is causing the issue.

Relevant parts of my schema.xml:

<schema>
    <types>
        <!-- Field type specifically for spell checking -->
        <fieldType name="textSpell" class="solr.TextField" positionIncrementGap="100" omitNorms="true">
            <analyzer type="index">
                <tokenizer class="solr.StandardTokenizerFactory" />
                <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
                <filter class="solr.LowerCaseFilterFactory" />
                <filter class="solr.StandardFilterFactory" />
            </analyzer>
            <analyzer type="query">
                <tokenizer class="solr.StandardTokenizerFactory" />
                <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true" />
                <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
                <filter class="solr.LowerCaseFilterFactory" />
                <filter class="solr.StandardFilterFactory" />
            </analyzer>
        </fieldType>
    </types>
    <fields>
        <field name="spell" type="textSpell" indexed="true" stored="false" multiValued="true" />
    </fields>

    <!-- Copy fields which are used to seed the spell checker -->
    <copyField source="name" dest="spell" />
    <copyField source="description" dest="spell" />
<schema>

Leave a Comment