I have just started using Solr and I am not sure what I am missing. I have 2 fields streetAddresses and cities. streetAddresses is text field and cities is string field. This is already been configured before I started looking at Solr. The schema.xml for the fields look like
<types>
<fieldType class="org.apache.solr.schema.TextField" name="TextField">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
<fieldType class="org.apache.solr.schema.StrField" name="StrField"/>
</types>
<fields>
<field indexed="true" multiValued="true" name="streetAddresses" stored="true" type="TextField"/>
<field docValues="true" indexed="true" multiValued="true" name="cities" stored="true" type="StrField"/>
</fields>
The issue is when I query multiple field the parsed string for streetAddresses has only first part of the string and the rest is ignored. For example if I search the streetAddresses for 111 Main St and cities for Boston, the query looks like
q=streetAddresses%3A111+Main+st+OR+cities%3ABoston&wt=json&indent=true&debugQuery=true&defType=edismax&qf=streetAddresses%2Ccities
And the debug looks like
"rawquerystring": "streetAddresses:111 Main st OR cities:Boston",
"querystring": "streetAddresses:111 Main st OR cities:Boston",
"parsedquery": "(+(streetAddresses:111 cities:Boston))/no_coord",
"parsedquery_toString": "+(streetAddresses:111 cities:Boston)",
"explain": {},
"QParser": "ExtendedDismaxQParser",
"altquerystring": null,
"boost_queries": null
I am getting the result based on 111 for the streetAddresses but the rest of the string (Main st) is ignored. I tried to search for the issue and some have mentioned about stopwords or wordlimit but I do not use any of that. Any idea?
streetAddresses:111 Main st OR cities:Boston
means "search for 111
in streetAddresses, Main
in the default search field (.. which may not be set by default any longer), st
in the default search field, and for Boston
in cities
.
If you want to search for 111 Main st
in streetAddresses
, you'll have to quote the value (and use a phrase search):
streetAddresses:"111 Main st"
.. or specify the field each time:
streetAddresses:111 streetAddresses:Main streetAddresses:st