Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solr suggest exact match

I am trying to make solr return exact match on suggestion, ex:

  • spellcheck.q=tota does return total in results but
  • spellcheck.q=total does not return total in results.

I am using this field for suggestions:

<fieldType name="textSpellShingle" class="solr.TextField" positionIncrementGap="100">
  <analyzer>
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.ShingleFilterFactory" maxShingleSize="3" outputUnigrams="true"/>
    <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  </analyzer>
</fieldType>

Any idea how to make Solr returns exact matches on suggest??

like image 486
user3687679 Avatar asked Nov 21 '22 14:11

user3687679


1 Answers

You are using the SpellChecker component, which, as the name indicate, is meant for spellchecking. It returns suggestions for how entry the should be spelled. When the word is spelled correct (which equals a exact match) it returns nothing, which is the reason you dont see the word in the list.

Since Solr 4.7 a new Suggestion component has been added, which is actually implemented for autosuggestion and yields the results you expect.

like image 132
Christian A Avatar answered Dec 19 '22 09:12

Christian A