Re: ranged and boolean query
hi, On Wed, Nov 17, 2010 at 04:39:00PM +0100, Peter Blokland wrote: i'm using solr and am trying to limit my resultset to documents that either have a publication date in the range * to now, or have no publication date set at all (field is not present). however, using this : (pubdate:[* TO NOW]) OR ( NOT pubdate:*) gives me only the documents in the range * to now (reversing the two clauses has no effect). answering my own question : the above expresseion was a filter-query, where the main query was (e.g.) type:page when only using the left-hand expression, this evaluates to type:page NOT pubdate:* which is a valid query. however, using the full expression seems to make lucene evaluate NOT pubdate:* as a query, which is not legal, and returns an empty result. so, re- writing the filter-query as (type:page AND pubdate:[* TO NOW]) OR (type:page NOT pubdate:*) solved my problem... took me long enough... -- CUL8R, Peter. www.desk.nl --- Sent from my NetBSD-powered Talkie Toaster™
Re: ranged and boolean query
hi, On Wed, Nov 17, 2010 at 05:00:04PM +0100, Peter Blokland wrote: pubdate:([* TO NOW] OR (NOT *)) i've gone back to the examples provided with solr 1.4.1. the standard example has 19 documents, one of which has a date-field called 'incubationdate_dt'. so the query incubationdate_dt:[* TO NOW] is expected to return 1 document, which it does. the query -incubationdate_dt:* is expected to return 18 documents, which it does. however, incubationdate_dt:[* TO NOW] (-incubationdate_dt:*) which should (imho) return all 19 documents just returns the one document that has such a field. can anyone confirm whether or not this is expected behavior, and if so, why ? -- CUL8R, Peter. www.desk.nl --- Sent from my NetBSD-powered Talkie Toaster™
ranged and boolean query
hi. i'm using solr and am trying to limit my resultset to documents that either have a publication date in the range * to now, or have no publication date set at all (field is not present). however, using this : (pubdate:[* TO NOW]) OR ( NOT pubdate:*) gives me only the documents in the range * to now (reversing the two clauses has no effect). using only NOT pubdate:* gives me the correct set of documents (those not having a pubddate). any reason the OR does not work in this case ? ps: also tried it like this : pubdate:([* TO NOW] OR (NOT *)) which gives the same result. -- CUL8R, Peter. www.desk.nl --- Sent from my NetBSD-powered Talkie Toaster™
Re: ranged and boolean query
On Wed, Nov 17, 2010 at 10:39 AM, Peter Blokland pe...@desk.nl wrote: hi. i'm using solr and am trying to limit my resultset to documents that either have a publication date in the range * to now, or have no publication date set at all (field is not present). however, using this : (pubdate:[* TO NOW]) OR ( NOT pubdate:*) gives me only the documents in the range * to now (reversing the two clauses has no effect). using only NOT pubdate:* gives me the correct set of documents (those not having a pubddate). any reason the OR does not work in this case ? ps: also tried it like this : pubdate:([* TO NOW] OR (NOT *)) which gives the same result. -- CUL8R, Peter. www.desk.nl --- Sent from my NetBSD-powered Talkie Toaster™ Peter, Instead of using NOT, try simply prefixing the field name with a minus sign. This tells SOLR to exclude the field. Otherwise, the word NOT would be treated as a term, and would be applied against your default field (which may or may not affect your results). So instead of (pubdate:[* TO NOW]) OR ( NOT pubdate:*), you would write (pubdate:[* TO NOW]) OR ( -pubdate:*). - Ken
Re: ranged and boolean query
hi, On Wed, Nov 17, 2010 at 10:54:48AM -0500, Ken Stanley wrote: pubdate:([* TO NOW] OR (NOT *)) Instead of using NOT, try simply prefixing the field name with a minus sign. This tells SOLR to exclude the field. Otherwise, the word NOT would be treated as a term, and would be applied against your default field (which may or may not affect your results). So instead of (pubdate:[* TO NOW]) OR ( NOT pubdate:*), you would write (pubdate:[* TO NOW]) OR ( -pubdate:*). tried that, it gives me exactly the same result... I can't really figure out what's going on. -- CUL8R, Peter. www.desk.nl --- Sent from my NetBSD-powered Talkie Toaster™
Re: ranged and boolean query
On Wed, Nov 17, 2010 at 11:00 AM, Peter Blokland pe...@desk.nl wrote: hi, On Wed, Nov 17, 2010 at 10:54:48AM -0500, Ken Stanley wrote: pubdate:([* TO NOW] OR (NOT *)) Instead of using NOT, try simply prefixing the field name with a minus sign. This tells SOLR to exclude the field. Otherwise, the word NOT would be treated as a term, and would be applied against your default field (which may or may not affect your results). So instead of (pubdate:[* TO NOW]) OR ( NOT pubdate:*), you would write (pubdate:[* TO NOW]) OR ( -pubdate:*). tried that, it gives me exactly the same result... I can't really figure out what's going on. -- CUL8R, Peter. www.desk.nl --- Sent from my NetBSD-powered Talkie Toaster™ If you append your URL with debugQuery=on, it will tell you how SOLR parsed your query. What's your schema look like? And what does the debug query look like?