Solr 3.5 – Search case insensitive on a string field for exact match



I use solr admin to find this data using query like this:


and found those data. But when I use this query:



Solr has by default in the schema.xml the field type “string” available.

 name=“string” class=“solr.StrField” sortMissingLast=“true” omitNorms=“true”/>

With this field type you can search with a string to get an exact match, instead of a contains match that the “text_general” field type will give you. However another difference is that the “text_general” field type iscase insensitive by default and “string” is case sensitive.

To perform an case insensitive exact match search, you’ll have to add a custom field type in your Solr schema.xml, I called it “string_ci” (string case insensitive).

 name=“string_ci” class=“solr.TextField” sortMissingLast=“true” omitNorms=“true”>

Now you have to create your field with type of string_ci.

 name=“address_s” type=“string_ci” sorted=“true” multivalued=“true”/>

or you can also change the type of predefine field

 name=“ss_*” type=“string_ci” sorted=“true” multivalued=“true”/>


Now Restart the solr server and do reindexing.

Now it will work for both