January 18, 2010

Solr Schema with Exact Match and Case Insensitive

The code bellow is what I have tried with many ways to search my data by matching the word without caring about case sensitive.

<fieldType name="string_ci" class="solr.StrField" sortMissingLast="true" omitNorms="true">
<analyzer type="index">
<tokenizer class="solr.PatternTokenizerFactory" pattern="!~#$!"/>
<filter class="solr.LowerCaseFilterFactory"/>

It doesn't work unless you index your data as lower case and make sure that you will restart your Solr's service and re-index your data again before you do your searching service.

Note: when your searching word has many words, you should use double quotes "".