solr search, avoid defaultSearchField
I have a solr search problem, currently our schema is setup have the following
<field name="trading_name" type="trading_name" indexed="true" stored="false" required="true" multiValued="false" omitNorms="true" />
<field name="trading_name_notoken" type="string" indexed="true" stored="false" required="true" multiValued="false" omitNorms="true" />
...
<copyField source="trading_name" dest="trading_name_notoken" />
...
<defaultSearchField>trading_name</defaultSearchField>
...
<fieldType name="trading_name" class="solr.TextField"开发者_如何学编程 positionIncrementGap="100">
<analyzer>...
I want to search on trading_name_notoken field instead of trading_name field, how should I build my search query?
Cheers
James
Use the df
(default field) parameter:
q=some query&df=trading_name_notoken
I am adding an extra field into SOLR which contains the lower case version of trading_name, hopefully it will sort out my problem
All you need is an analyzer which lowercases terms on that field. Have a look at this LowerCaseTokenizerFactory
精彩评论