I am using SOLR 4.10 core, and I have a field called PolicyReference with an IDX_PolicyReference index, and I am trying to set up an exact search on this field
So I execute a query like the following:
IDX_PolicyReference:ABC123
This has been working fine for years.
Now devs are sending PolicyReference values that contain a space: for example
IDX_PolicyReference:AB 123
This does not return the exact search result I am expecting.
From reading other questions on SO regarding this, it sounds like I need to turn off stemming.
I can successfully find the PolicyReference if I put double quotes around the value
IDX_PolicyReference:"AB 123"
But I'm trying to solve this without having to change the app that calls SOLR.
The schema.xml has the following elements in it.
<field name="PolicyReference" type="string" indexed="false" stored="true"/>
<copyField source="PolicyReference" dest="IDX_PolicyReference"/>
<field name="IDX_PolicyReference" type="text_Exact" indexed="true" stored="false" multiValued="true" />
<fieldType name="text_Exact" class="solr.TextField" 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>
My understanding was that when using KeywordTokenizerFactory, it takes the search term as one keyword. But it seems like space breaks it.
Is there another tokenizerfactory that I can use to achieve what I'm trying? Are there other attributes I can apply to the tokenizer xml element, or a filter that I can add that will turn off the stemming for this field - something that I can change in schema.xml and reindex that will allow my search request to work as is?
Again, I'm trying to avoid changing the app that calls SOLR.