solr suggester not returning any results

前端 未结 3 941
萌比男神i
萌比男神i 2020-12-08 15:09

I\'ve followed the solr wiki article for suggester almost to the T here: http://wiki.apache.org/solr/Suggester. I have the following xml in my solrconfig.xml:



        
相关标签:
3条回答
  • 2020-12-08 15:42

    Please check, if the term-parameter are set in the schema.xml, like:

    <field name="TEXT" type="text_en" indexed="true" stored="true" multiValued="true" 
                       termVectors="true"
                       termPositions="true"
                       termOffsets="true"/>
    

    ...restart solr and reindex again

    0 讨论(0)
  • 2020-12-08 15:43

    Could the problem be that you're querying /suggest instead of /spell

    ../suggest/?q=barbequ

    In my setup this the string I pass in:

    /solr/spell?q=barbequ&spellcheck=true&spellcheck.collate=true

    And the first time you do a spellcheck you need to include

    &spellcheck.build=true

    I'm running on solr 4 btw. So, perhaps /suggest is an entirely different endpoint that does something else. If so, apologize.

    0 讨论(0)
  • 2020-12-08 15:50

    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>
    
    0 讨论(0)
提交回复
热议问题