I wrote the title wrong, its a filter query, not a function query, thanks
for the correction.
The field is a string, I had tried  fq=stats_s:"New York"  before and that
did not work, I'm puzzled to why this didn't work.
I tried out your b suggestion and that worked,thanks!

On Tue, Sep 13, 2011 at 9:00 AM, Chris Hostetter
<hossman_luc...@fucit.org>wrote:

> : 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