Reputation: 869
I created a search application with the type string in Solr with PHP and is working fine. The only issue found is it can not support case insensitive search. Upon searching i found that solr doesn't support case insensitive search with the type "String".
So i created a custom type "string_ci" and configured as below.
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" /> -
<field name="loc_code" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="loc_name" type="string_ci" indexed="true" stored="true" required="true" multiValued="false" />
<field name="state" type="string" indexed="true" stored="true" required="true" multiValued="false" />
This is my field type definition for "string_ci"
<fieldType name="string_ci" class="solr.TextField"
sortMissingLast="true" omitNorms="true">
<analyzer>
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory" />
</analyzer>
</fieldType>
Unfortunately, this is not working. Can someone point out where i went wrong ?
Upvotes: 0
Views: 341
Reputation: 8678
Try with this
<fieldType name="string_ci" class="solr.TextField" sortMissingLast="true" omitNorms="true" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
Upvotes: 2