: Subject: using a function query with OR and spaces?

First off, what you are asking about is a "filter query" not a "function 
query"

https://wiki.apache.org/solr/CommonQueryParameters#fq

: I had queries breaking on me when there were spaces in the text I was
: searching for. Originally I had :
: 
: fq=state_s:New York
: and that would break, I found a work around by using:
: 
: fq={!raw f=state_s}New York

assuming the field is a StrField, the "raw" or "Term" QParsers will work, 
or you can quote the value using something like fq=stats_s:"New York"

: My problem now is doing this with an OR query,  this is what I have now, but
: it doesn't work:
        ...
: fq=({!raw f=country_s}United States OR {!raw f=city_s}New York

That's beacause:

a) local params (ie: the {! ...} syntax) must comeat the start of a SOlr 
Param as an instruction of how to parse it.

b) the "raw" and "term" QParsers don't support *any* query markup/syntax 
(like "OR" modifiers).  If you want to build a complex query using 
multiple clauses that are constucted using specific QParsers, you need to 
build them up using multiple query params and/or the "_query_" hook in the 
LuceneQParser...

fq=_query_:"{!term f=state_s}New York" OR _query_:"{!term f=country_s}United 
States"

https://wiki.apache.org/solr/LocalParams
http://www.lucidimagination.com/blog/2009/03/31/nested-queries-in-solr/


-Hoss

Reply via email to