1

I have a Solr document schema with with a solr.TrieDateField and noticed this boolean query (not authored by me) which I thought could benefit from some simplification;

q=-(-event_date:[2011-12-02T00:00:00.000Z TO NOW/DAY+90DAYS] OR (event_date:[* TO *]))

which means events within the next 90 days or non-events (See Pure Negative for Solr boolean NOT notation) . My simplification looked like

q=event_date:[2011-12-02T00:00:00.000Z TO NOW/DAY+90DAYS] OR -event_date:[* TO *]

As stated, this didn't work (0 results). So as a test I ran the two sides of my modified OR query individually and the sum of the two results (both non-zero) equaled the sum of the original query and I can't come up with a good explanation why. Running with debugQuery=true didn't present anything helpful. I've put this on solr-user, will post back with any solutions.

markdsievers
  • 7,151
  • 11
  • 51
  • 83
  • Do an explain on both queries, likely both are doing different things (you query are complicated for me) – ajreal Dec 02 '11 at 18:06
  • possible duplicate of [using OR and NOT in solr query](http://stackoverflow.com/questions/634765/using-or-and-not-in-solr-query) – Mauricio Scheffer Dec 02 '11 at 19:00

0 Answers0