Solr search query case sensitiveness

It depends on how you define your fields in schema.xml . If you use LowerCaseFilterFactory while indexing and querying , then all queries will be case-insensitive. Otherwise it will be case-sensitive.

<filter class="solr.LowerCaseTokenizerFactory"/>

You configure it within your schema. For example:

<fieldType name="text" class="solr.TextField" positionIncrementGap="100">
<analyzer type="query">
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>

means the field is considered lower case for queries this gives impression to be case-insensitive search.


Default defined Fields in the solr schema works very differently.

data type 'string' stores a word as an exact string not complete.

While 'text_general' typically performs tokenization, and secondary processing (such as case insensitive and whole string match). it is very Useful for all scenarios when we want to match part of a sentence.

If the following sample, "Search into the sentence", is indexed to both fields we must search for exactly the Search into the sentence to get a hit from the string field, while it will return the different result in case of text_general.

Here seller name will be match exactly in the search string, while product name will be search into the whole sentence above.

Example:

<field name="seller_name" type="string" indexed="true" stored="true"/>
<field name="product_name" type="text_general" indexed="true" stored="true"/>

Tags:

Java

Apache

Solr