Combining the syntax of two (or more) query parsers in a single query is called "nested queries". This requires two elements: 1) the use of the "magic" field "_query_" to embed or nest a query in a larger query, and 2) enclosing the nested query in quotes since it is likely to have reserved characters that would otherwise interfere with the parsing of the enclosing query syntax.

So, your example of:

   fq=device:0 OR {!term f=model}Vivid(PH39100)

should be written as:

   fq=device:0 OR _query_:"{!term f=model}Vivid(PH39100)"

See:
http://wiki.apache.org/solr/SolrQuerySyntax

-- Jack Krupansky
-----Original Message----- From: abhayd
Sent: Friday, May 11, 2012 10:56 AM
To: solr-user@lucene.apache.org
Subject: Re: {!term f)xy OR device:0 in fq has strange results

reformatted the same

hi

I am having some issues in using {!term} in fq with OR

Following query returns 6 results and it is working as expected
q=navigation&fq={!term f=model}Vivid(PH39100)
And debug out put is also as expected
Debug:
"QParser":"LuceneQParser",
"filter_queries":["{!term f=model}Vivid(PH39100)"],
"parsed_filter_queries":["model:Vivid(PH39100)"],



Now I want to add OR to  fq and it is not working as expected at all
q=navigation&fq=device:0 OR {!term f=model}Vivid(PH39100)
This is returning only 3 results

I dont understand parsed_filter_queries output here why its doing
+text:vivid
Debug:
   "QParser":"LuceneQParser",
   "filter_queries":["device:0 OR {!term f=model}Vivid(PH39100)"],
   "parsed_filter_queries":["device:0 text:{!term TO f=model} +text:vivid
+MultiPhraseQuery(text:\"ph (39100 ph39100)\")"],


How do i fix this issue?

thanks
abhay

--
View this message in context: http://lucene.472066.n3.nabble.com/term-f-xy-OR-device-0-in-fq-has-strange-results-tp3980152p3980156.html Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to