[pylucene-dev] Prohibited field query
Peter Fein
pfein at pobox.com
Mon Dec 11 07:15:33 PST 2006
On Monday 11 December 2006 07:20, Georges Racinet wrote:
> First post to the list, I'd like to congratulate first PyLucene devs
-1 Karma. Go back to Slashdot. ;)
> I'm trying to fire a prohibited request on a field
> I've tried many things, including going through QueryParser, nothing
> worked so far (I always get 0 matches, which is wrong).
> This is on PyLucene 1.9.1 (upgrading isn't a option, sadly).
If I'm reading correctly, you're trying to retrieve all docs where
status!=hidden. In lucene, a search consisting only of negative terms always
returns no results. If you AND some positive terms into your query, things
will work as you want.
If you do really want only those docs with -status:hidden, you may be able to
AND it with
http://lucene.apache.org/java/docs/api/org/apache/lucene/search/MatchAllDocsQuery.html,
though I've never tried it & I don't know if it's even available under 1.9.
If you're still stuck, the LIA book describes other approaches for solving
this problem (ANDing w/ a term you know to be in all for your docs, IIRC).
You could also enumerate all of the other values of the status field w/ OR
(assuming you know all of them ahead of time).
--
Peter Fein pfein at pobox.com
773-575-0694 Jabber: peter.fein at gmail.com
http://www.pobox.com/~pfein/ irc://irc.freenode.net/#chipy
More information about the pylucene-dev
mailing list