简体   繁体   English

Solr 6.6.0不区分大小写的查询不起作用

[英]Solr 6.6.0 Case Insensitive Query Not Working

Solr 6.6.0 Case Insensitive Query Not Working. Solr 6.6.0不区分大小写的查询不起作用。 I had tried all other option/answer available on internet. 我尝试了互联网上所有其他可用的选项/答案。

I had tired with, 我已经厌倦了

<tokenizer class="solr.LowerCaseTokenizerFactory"/> 

but its not working. 但它不起作用。

I had tired with, 我已经厌倦了

<filter class="solr.LowerCaseFilterFactory"/>

but its not working. 但它不起作用。

I had tired many different way, but none working. 我已经厌倦了许多不同的方式,但是没有一个工作。

ie I want same result searching with title_s:iPhone and title_s:iphone. 即我想要使用title_s:iPhone和title_s:iphone搜索相同的结果。

I am not sure what would cause problem. 我不确定会导致什么问题。

If case insensitive search was not working in a Solr release, you would get much more noise than just one stack overflow question. 如果不区分大小写的搜索在Solr发行版中不起作用,那么您将获得比仅一个堆栈溢出问题更多的噪音。

Let's use this question to illustrate the approach everyone should follow for basic Solr usage : 让我们用这个问题来说明每个人在使用Solr时应该遵循的方法:

1) Refer to the documentation - Solr has a good free online documentation. 1) 请参考文档 -Solr有一个很好的免费在线文档。 Specifically describing how to configure the schema.xml and the various aspects of it [1]. 具体描述如何配置schema.xml及其各个方面[1]。 From there you can learn that is quite simple to configure a field to be case insensitive : 从那里您可以了解到,将字段配置为不区分大小写非常简单:

 <field name="title" type="text_case_insensitive" indexed="true" stored="true"/> <fieldType name="text_case_insensitive" class="solr.TextField" positionIncrementGap="100"> <analyzer type="index"> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory"/> </analyzer> <analyzer type="query"> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory"/> </analyzer> </fieldType> 

NB if you had a previous configuration in the schema for the title field, you need to re-index 注意,如果您在标题字段的架构中具有先前的配置,则需要重新索引

[1] https://lucene.apache.org/solr/guide/6_6/field-type-definitions-and-properties.html [1] https://lucene.apache.org/solr/guide/6_6/field-type-definitions-and-properties.html

I had tried in many different way, but none work. 我尝试了许多不同的方法,但是没有用。 Than I had implement as below and it work fine. 比我实现以下方法要好,它可以正常工作。

Let me know below method is correct or not, but works fine for me :) 让我知道以下方法是否正确,但对我来说很好:)

I had remove below code from schema, 我从架构中删除了以下代码,

<fieldType name="string" class="solr.StrField" sortMissingLast="true" docValues="true"/>

And added (replace) below code, 并添加(替换)下面的代码,

<fieldType name="string" class="solr.TextField">
  <analyzer type="index">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
</fieldType>

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

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