Solr Pattern replacement filter after Ngram filter

82 Views Asked by At

Basically I am trying for spell correction to some extent, I am using query analyzer as mentioned,

<analyzer type="query">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="0" preserveOriginal="1"/>
        <filter class="solr.LengthFilterFactory" min="2" max="100" />
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt" />
        <filter class="solr.NGramFilterFactory" minGramSize="4" maxGramSize="30" />
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>

I want to add * to tokens generated by NGramFilterFactory. How to append * for all the tokens emerging out of NGramFilterFactory? Advance Thanks for your suggestion.

1

There are 1 best solutions below

0
Okke Klein On

You don't. Using n-grams is a way to enable search without wildcards and is often used as it performs better.

Let the spellchecker itself handle the partial matches and feed high quality terms into the dictionary to get best results.