1

OR condition is not working for me. Filter Query I am using is:

fq=+(field1:true OR field2:[1 TO *])

Individual:

  1. fq=+(field1:true)
  2. fq=+(field2:[1 to *])

This works just fine. But ORing of these two conditions is not working as expected.

Am I doing something wrong?

Machavity
  • 30,841
  • 27
  • 92
  • 100
Pratyush
  • 11
  • 2
  • Why are you using `+`? – alexf Jul 27 '15 at 15:27
  • + is I guess for mandatory clause. – Pratyush Jul 27 '15 at 15:56
  • I did, it's not working! :( – Pratyush Jul 28 '15 at 07:34
  • What happens if you just use `fq = field1:true OR field2:[1 TO *]` ? It should work, this is the right syntax. – alexf Jul 28 '15 at 09:15
  • You can also try something like `fq = +field1:true +field2:[1 TO *]`. – alexf Jul 28 '15 at 09:17
  • yes, tried that as well. Still no luck. Following is the output with debugQuery=true. ads_f13003:true OR inv_strlocqty_10151_10552:[1 TO *] ads_f13003:true inv_strlocqty_10151_10552:[1.0 TO *] – Pratyush Jul 29 '15 at 13:05
  • Please explain the difference of results between the 2 queries ! – alexf Jul 29 '15 at 13:33
  • 1. There is no difference in the resultset. The filter is not working as per expectation. 2. can't use fq = +field1:true +field2:[1 TO *] because that is AND operator equivalent – Pratyush Jul 30 '15 at 16:57
  • An update: 1) fq=field1:true OR field2:false =>works just fine. 2)fq=field1:true OR field2:[1 TO *] => does not work. So the new problem statement is: "OR operator with one of the expressions as range query does not work." – Pratyush Jul 30 '15 at 17:00
  • Try your query with parenthesis: `fq=(field1:true) OR (field2:[1 TO *])`. [link](http://stackoverflow.com/questions/17221736/whats-wrong-with-this-solr-range-filter-query) – alexf Jul 31 '15 at 07:06
  • Unfortunately, adding parenthesis did not work :( fq=(field1:true) OR (field2:[1 TO *]) --> did not work!! :( – Pratyush Aug 12 '15 at 13:38

0 Answers0