Rajesh
Rajesh

Reputation: 51

Case sensitive and case insenistive search in solr

I indexed data in solr using following field type configuration. On which I can perform only case insensitive search. Eg :If I am typing text:Abc or abc is giving same result .

 <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
  <analyzer type="index">
    <tokenizer class="solr.ClassicTokenizerFactory"/>
    <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
    <filter class="solr.StandardFilterFactory"/>
    <!-- in this example, we will only use synonyms at query time
    <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
    -->
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.ClassicTokenizerFactory"/>
    <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
    <filter class="solr.StandardFilterFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
</fieldType>

But now my requirement got changed.Suppose If I am searching for Abc then it should give all result matching with Abc not abc,reverse also should work.

Is it possible with current configuration? If not then what configuration should I use. please suggest me .

Upvotes: 0

Views: 397

Answers (1)

javacreed
javacreed

Reputation: 968

Just remove the lowercase filter from your tokenizer and it should solve your problem. Then it will not convert the tokens into lowercase and hence give you the desired results.

Upvotes: 2

Related Questions