简体   繁体   English

在 Solr 中避免词干搜索的一个词短语搜索

[英]One word phrase search to avoid stemming in Solr

I have stemming enabled in my Solr instance, I had assumed that in order to perform an exact word search without disabling stemming, it would be as simple as putting the word into quotes.我在我的 Solr 实例中启用了词干提取,我假设为了在不禁用词干提取的情况下执行精确的单词搜索,就像将单词放在引号中一样简单。 This however does not appear to be the case?然而,情况似乎并非如此?

Is there a simple way to achieve this?有没有一种简单的方法可以实现这一目标?

There is a simple way, if what you're referring to is the "slop" (required similarity) as part of a fuzzy search (see the Lucene Query Syntax here).有一种简单的方法,如果您指的是作为模糊搜索的一部分的“slop”(所需的相似性)(请参阅此处的Lucene 查询语法)。

For example, if I perform this search:例如,如果我执行此搜索:

 q=field_name:determine

I see results that contain "determine", "determining", "determined", etc.. If I then modify the query like so:我看到包含“确定”、“确定”、“确定”等的结果。如果我然后像这样修改查询:

 q=field_name:determine~1

I only see results that contain the word "determine".我只看到包含“确定”一词的结果。 This is because I'm specifying a required similarity of 1, which means "exact match".这是因为我指定了所需的相似性 1,这意味着“完全匹配”。 I can specify this value anywhere from 0 to 1.我可以指定从 0 到 1 的任何值。

Another thing you can do is index the same text without stemming in one field, and with stemming in another.您可以做的另一件事是索引相同的文本,而不在一个字段中提取词干,而在另一个字段中提取词干。 Boost the non-stemmed field & that should prefer exact versions of words to stemmed versions.提升非词干领域,应该更喜欢词的精确版本而不是词干版本。 Of course you could also write your own query parser that directs quoted phrases to the non-stemmed field only.当然,您也可以编写自己的查询解析器,将引用的短语仅定向到非词干字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM