Point number 3 from that wiki says it all:

3.The document sets from each filter query are cached independently. Thus, concerning the previous examples: use a single fq containing two mandatory clauses if those clauses appear together often, and use two separate fq params if they are relatively independent.

FWIW, there is not "&" operator in Lucene/Solr query syntax. There is the "&&" operator which is equivalent to "AND", but each of the ampersands must be URL-encoded as %26 to use them in a query in a URL.

So, yes, you can use the "AND" operator, as:

 fq=term1:foo AND fq=term2:bar

or

 fq=term1:foo %26%26 fq=term2:bar

Note that this is not valid in a URL:

 fq=term1:foo & fq=term2:bar

It must be written as:

 fq=term1:foo &fq=term2:bar

The "&" marks the start of a new query parameter - but that is "query" in the sense of the URL query, not a Solr query. The "&" must be immediately followed by the parameter name and an "=".

-- Jack Krupansky

-----Original Message----- From: geeky2
Sent: Monday, March 11, 2013 4:41 PM
To: solr-user@lucene.apache.org
Subject: question about syntax for multiple terms in filter query

hello everyone,

i have a question on the filter query syntax for multiple terms, after
reading this:

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

i see from the above that two (2) syntax constructs are supported

fq=term1:foo & fq=term2:bar

and

fq=+term1:foo +term2:bar

is there a reason why i would want to use one syntax over the other?

does the first syntax support the "and" operand as well as the "&"?

thx
mark




--
View this message in context: http://lucene.472066.n3.nabble.com/question-about-syntax-for-multiple-terms-in-filter-query-tp4046442.html Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to