gpt4 book ai didi

solr - 如何在 Suggester 中忽略区分大小写? Solr 3.6

转载 作者:行者123 更新时间:2023-12-04 18:13:50 24 4
gpt4 key购买 nike

目前正在研究 Solr 3.6 中的 Suggester。我已经通过提供外部词典源来配置 Suggester。

solrconfig.xml:

 <searchComponent name="spellcheck" class="solr.SpellCheckComponent">

<str name="queryAnalyzerFieldType">textSpell</str>

<lst name="spellchecker">
<str name="name">suggest</str>
<str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
<str name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookup</str>
<float name="threshold">0.005</float>
<str name="buildOnCommit">true</str>
<bool name="exactMatchFirst">true</bool>
<str name="sourceLocation">D:\source.txt</str>

</lst>

</searchComponent>

来源.txt:

nokia   2
nokia 5233 3
nokia 5130 2
Symbian 1
samsung 6712 2
htc 2
HTC Wild 6
htc one 7
Nokia 1280 5

当我尝试使用“n”进行搜索时,它会提示我以下结果

nokia 5233
nokia 5130
nokia

但结果不包含在“Nokia 1280”中。

可能是什么原因?如何在 Suggester 中忽略区分大小写?

最佳答案

我认为这篇文章会对你有所帮助,https://cwiki.apache.org/confluence/display/solr/Suggester

尝试在你的建议中使用“field”参数

    <searchComponent name="spellcheck" class="solr.SpellCheckComponent">
<str name="queryAnalyzerFieldType">textSpell</str>
<lst name="spellchecker">
<str name="name">suggest</str>
<str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
<str name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookup</str>
<float name="threshold">0.005</float>
<str name="buildOnCommit">true</str>
<bool name="exactMatchFirst">true</bool>
<str name="field">phoneName</str>
<str name="sourceLocation">D:\source.txt</str>
</lst>
</searchComponent>

字段类型定义

    <fieldType class="solr.TextField" name="textSuggest" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>

字段定义

    <field name="phoneName" type="string" indexed="true" stored="false" required="false" multiValued="false"/>

关于solr - 如何在 Suggester 中忽略区分大小写? Solr 3.6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12490480/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com