我对 Solr 的建议器存在以下问题:它多次返回相同的值,并且所有权重都为零。我希望它只返回每个值一次,并根据频率赋予权重。
这是我的配置:
<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">infixSuggester</str>
<str name="lookupImpl">AnalyzingInfixLookupFactory</str>
<str name="indexPath">infix_suggestions</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">title_suggest</str>
<str name="suggestAnalyzerFieldType">phrase_suggest</str>
<str name="buildOnStartup">true</str>
<str name="buildOnCommit">true</str>
</lst>
</searchComponent>
<requestHandler name="/suggest" class="solr.SearchHandler">
<lst name="defaults">
<str name="suggest.dictionary">infixSuggester</str>
<str name="suggest.onlyMorePopular">true</str>
<str name="suggest">true</str>
<str name="suggest.count">500</str>
<str name="suggest.collate">true</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
当我调用例如 suggest?q=test 时,我得到类似的信息:
"suggestions":[{
"term":"This is a test suggestion",
"weight":0,
"payload":""},
{
"term":"This is a test suggestion",
"weight":0,
"payload":""},
{
"term":"Another test example",
"weight":0,
"payload":""}]
所以我必须在我的客户端中进行处理才能只获得最流行的完成。我希望有更接近的东西:
"suggestions":[{
"term":"This is a test suggestion",
"weight":2,
"payload":""},
{
"term":"Another test example",
"weight":1,
"payload":""}]
这可能吗?
谢谢!
严
最佳答案
您可以改用BlishedInfixLookupFactory建议器,它是AnalyzingInfixLookupFactory的高级版本,为您提供其他功能并删除重复项...双赢!
关于Solr 建议器多次返回相同的结果,但权重为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49453316/