Getting most likely documents of the query using phonetic filter in solr

妖精的绣舞 提交于 2019-12-18 07:15:20

问题


I am using solr for spell checking/ query correction. I have added solr.PhoneticFilterFactory and solr.NGramFilterFactory in fieldType to perform spell checking. It is working fine but here the problem is that I am getting number of documents of the query. I need only most likely words/documents or in similar words, we can say that nearer words/documents to the query.

Snippet of schema.xml :

<fieldType name="textSpell" class="solr.TextField" positionIncrementGap="100">
       <analyzer type="index">         
        <filter class="solr.TrimFilterFactory"/>        
        <filter class="solr.NGramFilterFactory" minGramSize="2" maxGramSize="1000" />
        <filter class="solr.LowerCaseFilterFactory"/>
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>        
        <filter class="solr.PhoneticFilterFactory" encoder="DoubleMetaphone" inject="true"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
    </analyzer>
    <analyzer type="query">
        <filter class="solr.TrimFilterFactory"/>
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>        
        <filter class="solr.LowerCaseFilterFactory"/>       
        <filter class="solr.PhoneticFilterFactory" encoder="DoubleMetaphone" inject="true"/>
    </analyzer>
</fieldType>

Example : For a query "piece". I am getting around 780 NumFound(Number of documents). I need to reduce this counts but with most likely number of documents.

来源:https://stackoverflow.com/questions/27484326/getting-most-likely-documents-of-the-query-using-phonetic-filter-in-solr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!