Threshold frequency is not working in spell check

2019-07-21 07:39发布

问题:

I am get stuck in middle of Solr. I need only most popular words w.r.t query. I have used phonetic filter on both index and query but here the problem is that it is giving too many terms. I need only few terms which are very specific to the query.

schema.xml

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

solrconfig.xml

    <lst name="spellchecker">
      <str name="name">default</str>
      <str name="field">term</str>
      <str name="classname">solr.DirectSolrSpellChecker</str>
      <str name="distanceMeasure">internal</str>
      <float name="accuracy">0.5</float>
      <int name="maxEdits">2</int>
      <int name="minPrefix">1</int>
      <int name="maxInspections">5</int>
      <int name="minQueryLength">4</int>
      <float name="maxQueryFrequency">0.90</float>
      <float name="thresholdTokenFrequency">0.90</float>
    </lst>

<requestHandler name="/spell" class="solr.SearchHandler" startup="lazy">
    <lst name="defaults">
      <str name="df">term</str>
      <str name="spellcheck.dictionary">default</str>
      <str name="spellcheck">on</str>
      <str name="spellcheck.extendedResults">true</str>       
      <str name="spellcheck.count">10</str>
      <str name="spellcheck.alternativeTermCount">10</str>
      <str name="spellcheck.maxResultsForSuggest">10</str>
      <str name="spellcheck.collate">true</str>
      <str name="spellcheck.collateExtendedResults">true</str>  
      <str name="spellcheck.maxCollationTries">10</str>
      <str name="spellcheck.maxCollations">5</str>
      <str name="spellcheck.onlyMorePopular">true</str>
    </lst>
    <arr name="last-components">
      <str>spellcheck</str>
    </arr>
  </requestHandler>

I am also using thresholdTokenFrequency but it not working I have tried by varying the value of threshold between 0 and 1. but it always gives same result. Any help ?