【问题标题】:Collations are not working fine in Solr排序规则在 Solr 中无法正常工作
【发布时间】:2015-02-09 13:47:44
【问题描述】:

我正在 Solr 中进行拼写检查。我在拼写检查器组件中实现了Suggestionscollat​​ions

Most of the time collations work fine but in few case it fails.

工作:

我试过query:gone wthh thes wnd:在这个wnd中没有给出建议wind但是collat​​ion来了正确 = 随风而逝hits = 117

不工作:

但是当我尝试query: gone wthh thes wint:在这方面,wint 确实给出了建议 windcollat​​ion 不会来强>对。而不是随风而逝,而是随风而逝hits = 1

我也想知道collat​​ions中的hits是什么。

配置:

solrconfig.xml:

<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
    <str name="queryAnalyzerFieldType">textSpellCi</str>
    <lst name="spellchecker">
      <str name="name">default</str>
      <str name="field">gram_ci</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">0</int>
      <int name="maxInspections">5</int>
      <int name="minQueryLength">2</int>
      <float name="maxQueryFrequency">0.9</float>
      <str name="comparatorClass">freq</str>
    </lst>
</searchComponent>

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

Schema.xml:

<field name="gram_ci" type="textSpellCi" indexed="true" stored="true" multiValued="false"/>

</fieldType><fieldType name="textSpellCi" class="solr.TextField" positionIncrementGap="100">
       <analyzer type="index">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ShingleFilterFactory" maxShingleSize="5" minShingleSize="2" outputUnigrams="true"/>
</analyzer>
    <analyzer type="query">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ShingleFilterFactory" maxShingleSize="5" minShingleSize="2" outputUnigrams="true"/>
</analyzer>
</fieldType>

【问题讨论】:

    标签: solr collation spell-checking search-suggestion


    【解决方案1】:

    我得到了我的问题的答案。经过深度阅读,我发现了collat​​ions背后的逻辑。

    1) spellcheck.maxCollations:它只是整理候选人来测试索引。

    2) spellcheck.maxCollationTries : 它评估在 spellcheck.maxCollat​​ions 时构建的排序规则。如果我们设置spellcheck.maxCollationTries low的值,那么它会给出更好的排序规则,而如果我们设置spellcheck.maxCollationTries high的值,那么它提供了更多的整理结果,但它损害了性能

    所以,通过增加spellcheck.maxCollationTries的值,它给出了gone wthh the wintgone with the wind的排序规则,但是我再说一遍,它损害性能。

    【讨论】:

    • 我想做拼写/查询更正功能。我有 49 GB 的索引数据,我在其中应用了拼写检查器。我想和谷歌一样——“你的意思是”。示例 - 如果任何用户键入任何可能拼写错误或键入错误的问题/查询。我需要给他们一些建议,比如“你的意思是”。 Solr 最适合它吗?
    猜你喜欢
    • 1970-01-01
    • 2018-12-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多