Reputation: 3400
I have following string indexed into solr.
<doc>
<field name="key">book self</field> </doc>
<doc>
<field name="key">bookself</field> </doc>
<doc>
<field name="key">my book self</field> </doc>
When my query string have the word key:"book self" then i should only get first doc as result not the first and third document. Same when i search for key:"self" it should return empty document.
Please tell me how i can achieve above.
Upvotes: 1
Views: 1758
Reputation: 8678
Change the field Type to string.
Make sure you have the below entry
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
The StrField type is not analyzed, but indexed/stored.
Then change the field type for the field key.
<field name="key" type="string" indexed="true" stored="true"/>
Upvotes: 1
Reputation: 3861
If you need an exact match, you should use string
instead of text_general
. If, for whatever reason, you do actually need text_general
for this document, use <copyField/>
to generate a 2nd field that has type string
and which you then use for the exact match.
Upvotes: 4