2

被困Solr中间。我只需要最流行的单词wrt query。我在索引和查询上都使用了语音过滤器,但这里的问题是它给出了太多的术语。我只需要几个非常特定于查询的术语。

架构.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>

我也在使用thresholdTokenFrequency但它不起作用我尝试通过在0 和 1之间改变阈值的值。但它总是给出相同的结果。有什么帮助吗?

4

0 回答 0