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