使用 solr 从段落中搜索具有大写字母的单词
我正在使用 solr 进行搜索。当我搜索描述中包含大写字母的单词时
,它不显示任何结果。但它给出了小写字母的结果..
例如:如果我的查询是 q=description:* stack * ,我将得到结果。但是,如果查询是
q=description:* Stack * ,即使描述包含该单词,它也不会给出任何结果
我的架构包含:
<fieldType name="string" class="solr.TextField">
<analyzer type="index">
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.ASCIIFoldingFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory" />
<filter class="solr.ReversedWildcardFilterFactory" />
</analyzer>
<analyzer type="query">
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.ASCIIFoldingFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory" />
<filter class="solr.ReversedWildcardFilterFactory" />
</analyzer>
</fieldType>
我也想用大写字母进行搜索..
有人可以帮助我吗?
I am using solr for searching. When i search a word contains uppercase letters from
description, its not showing any result. But it gives result for lowercase letters ..
Eg: If my query is q=description:* stack * , i will get the result . But if query is
q=description:* Stack * , it wont give any result evenif description contains that word
My schema contains :
<fieldType name="string" class="solr.TextField">
<analyzer type="index">
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.ASCIIFoldingFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory" />
<filter class="solr.ReversedWildcardFilterFactory" />
</analyzer>
<analyzer type="query">
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.ASCIIFoldingFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory" />
<filter class="solr.ReversedWildcardFilterFactory" />
</analyzer>
</fieldType>
I want to search with upper case letters also..
Can someone help me ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 Solr wiki。它说:
在更改架构以反映 wiki 说明后,尝试使用
debugQuery=on
进行查询:如您所见,
ReversedWildcardFilterFactory
会更改您的查询,即使它不在您的查询中分析器链,其 fieldType 如下所示:此外,不会为您的查询触发
LowerCaseFilterFactory
(S
在解析的查询中不是小写)。ASCIIFoldingFilterFactory
也会发生同样的情况。看看这里了解更多:
我想到的最简单的解决方案是在将查询发送到 Solr 之前在客户端将其设置为小写。您还应该考虑
ASCIIFoldingFilterFactory
也不会被触发。你真的需要它吗?Have a look at the Solr wiki. It says:
Try querying with
debugQuery=on
after you've changed the schema to reflect the wiki instructions:As you can see, the
ReversedWildcardFilterFactory
changes your query even if it's not in your query analyzer chain, with a fieldType like this:Furthermore, the
LowerCaseFilterFactory
is not fired for your query (theS
is not lowercase in the parsed query). The same happens forASCIIFoldingFilterFactory
.Have a look here to know more:
The easiest solution that comes in my mind is making your queries lowercase on client side, before sending them to Solr. You should also consider that the
ASCIIFoldingFilterFactory
is not fired either. Do you really need it?