Reputation: 964
I am facing issue in Solr search. My schema is as follows
<fieldType name="c_text" class="solr.TextField">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
<field name="parentId" type="string" indexed="true" stored="true"/>
<field name="data_s" type="c_text" indexed="true" stored="true"/>
<field name="email" type="string" indexed="true" stored="true"/>
<field name="receivedDate" type="tdate" indexed="true" stored="true"/>
I am searching on email field. which contains the data in following format
Tarun Nagpal <[email protected]>
//This is working fine
email:*tarun*
But following is giving no result
email:"Tarun Nagpal"
Can you please help, why it is not searching phrase like search on email field. Search on data_s field is working fine.
Upvotes: 1
Views: 246
Reputation: 23088
You need to use the text field type since you intend to search the tokens:
To be specific for Tarun Nagpal <[email protected]>
:
A string field will answer ==
equality and wildcard queries like *un Nagp*
, *[email protected]>
and even more apparently exotic queries.
A text field will answer to the tokens tarun
, nagpal
, tarunn
abc
and com
.
Other field types implementing N-gram and Soundex can even correct your spelling.
See the excellent https://stackoverflow.com/a/2119479/604511
Upvotes: 3