Reputation: 31
Im using the solr engine to an e-commerce website I have store the search tags as a sting in a single field as below, I need to get convert that field to case insensitive.I tried to apply the lowercase filter factory and it goes not work for the field
<field name="tags" type="string" multiValued="true" indexed="true" stored="true"/>
<fieldType name="string" class="solr.StrField" sortMissingLast="true" docValues="true"/>
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
Sample of the field
"tags":["Property",
"House",
"Land",
"Home",
"House For Sale",
"Property For Sale",
"Land For Sale",
"Prime property for sale",
"Prime property for sale in Colombo 03"],
Upvotes: 0
Views: 679
Reputation: 52802
You have defined your field as StrField
. String fields can't have analysis chains attached. You have to change it to a TextField
:
<fieldType name="string" class="solr.TextField" sortMissingLast="true" docValues="true"/>
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
However, I'd recommend using a different name than string
for the field, since the string
field type is expected to work in a particular way (such as when used for id
fields, etc.). Instead, use something describing what it does, such as string_caseinsensitive
.
Upvotes: 1