0

Solr 6.6.0 Case Insensitive Query Not Working. 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.

i.e I want same result searching with title_s:iPhone and title_s:iphone.

I am not sure what would cause problem.

Kiran
  • 1,176
  • 2
  • 14
  • 27

2 Answers2

0

If case insensitive search was not working in a Solr release, you would get much more noise than just one stack overflow question.

Let's use this question to illustrate the approach everyone should follow for basic Solr usage :

1) Refer to the documentation - Solr has a good free online documentation. Specifically describing how to configure the schema.xml and the various aspects of it [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>

N.B. 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

  • You can find managed-schema (used in solr 6.6) https://codepen.io/anon/pen/WXEwNw In HTML column – Kiran Nov 15 '17 at 09:46
0

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>
Kiran
  • 1,176
  • 2
  • 14
  • 27