Maged Makled
Maged Makled

Reputation: 1986

SOLR OR query behaving like an AND QUERY

Running a SOLR OR query (end_date=* | start_date!=*), it is behaving as an AND query and returning no results. If I run each query separately, it return results for each.

Upvotes: 0

Views: 98

Answers (2)

Maged Makled
Maged Makled

Reputation: 1986

I found the problem. This code (end_date=* | start_date!=*)

gets converted into a Solr syntax

(end_date:[* TO *] OR -start_date:[* TO *]) note "-" negation

which in my testing data both start_date and end_date either had values or didn't have values which is why it was returning no results.

Upvotes: 0

MatsLindh
MatsLindh

Reputation: 52822

The OR operator in The Standard Query Parser in Solr is either OR (in caps) or ||. I'm not sure if the query you're using is correct either (if you're checking for whether a field exists, [* TO *] is the usual way of doing that).

Upvotes: 2

Related Questions