Although pure negative queries are supposed to work, there have been bugs in various releases, so make the query explicit:

*:* -author_location:unset

Do you actually use an explicit string of "unset" when adding documents?

-- Jack Krupansky

-----Original Message----- From: A Geek
Sent: Sunday, March 10, 2013 7:06 AM
To: solr user
Subject: How to combine Date range query with negation query


Hi All, I'm trying to run a query against the following fields: <field name="author_location" type="string" indexed="true" stored="true" default="unset" />and <field name="created_at" type="date" indexed="true" stored="true"/>

against For majority of the documents the author_location is default i.e. "unset" . I want to run a query where the author_location has got some value other than "unset" and the created_at field is greater a given timestamp. I tried running the following query: <str name="q">-author_location:unset&created_at:[2013-03-10T06:30:21Z TO *]</str>but its not working and its dumping results which contains author_location=unset. I also tried the following using filter query, but it seems the query is not correct or something like that as I'm getting the results that includes author_location=unset documents. Would appreciate if someone could point me to the right query. Please note that, I'm running SOLR: solr-spec 4.0.0.2012.10.06.03.04.33on a Linux machine.
Thanks in advance.
Regards, DK



Reply via email to