gpt4 book ai didi

Solr 停用词和空查询

转载 作者:行者123 更新时间:2023-12-03 17:38:38 25 4
gpt4 key购买 nike

我有一个带有多个文档和一个索引字段的 Solr 实例。

我现在想将查询中的停用词列表应用于 增加结果的数量,通过在查询时完全忽略停用词列表中包含的词。

因此在我的配置中我使用 solr.StopFilterFactoryquery分析器。

我期望的是,如果我只使用停用词列表中的一个词执行搜索,结果集与通配符查询相同,text_title:* ,这是完整的文档集。

但相反,我得到了 0 个结果。我是否缺少有关停用词过滤器行为的信息?

最佳答案

solr.StopFilterFactory

This filter discards, or stops analysis of, tokens that are on the given stop words list. A standard stop words list is included in the Solr config directory, named stopwords.txt, which is appropriate for typical English language text.



https://cwiki.apache.org/confluence/display/solr/Filter+Descriptions#FilterDescriptions-StopFilter

此过滤器实际上会删除您查询中的标记,而不是替换为 *例子 :
In: "To be or what?"
Tokenizer to Filter: "To"(1), "be"(2), "or"(3), "what"(4)
Out: "To"(1), "what"(4)

尝试使用此过滤器。
solr.SuggestStopFilterFactory

Like Stop Filter, this filter discards, or stops analysis of, tokens that are on the given stop words list. Suggest Stop Filter differs from Stop Filter in that it will not remove the last token unless it is followed by a token separator.



您通常会在索引分析器中使用普通的 StopFilterFactory,然后在查询分析器中使用 SuggestStopFilter。

如果后面没有标记分隔符,此过滤器将从您的查询中删除停用词。

如何使用:
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.SuggestStopFilterFactory" ignoreCase="true" words="stopwords.txt" format="wordset"/>
</analyzer>

例子 :
In: "The The"
Tokenizer to Filter: "the"(1), "the"(2)
Out: "the"(2)

关于Solr 停用词和空查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41959657/

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