[pylucene-dev] Prohibited field query
gracinet at nuxeo.com
Mon Dec 11 08:29:52 PST 2006
On Dec 11, 2006, at 4:15 PM, Peter Fein wrote:
> 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. ;)
How the hell did you guess I can't pretend to be nice ?
>> 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.
Gasp, I saw this mentionned in the QueryParser syntax doc. Got
it's inside the "NOT" operator section, so I thought '-' was the way
to go. How stupid.
> If you do really want only those docs with -status:hidden, you may
> be able to
> AND it with
> though I've never tried it & I don't know if it's even available
> under 1.9.
It is, it's exposed in PyLucene, and it works. Thanks !
> If you're still stuck, the LIA book describes other approaches for
> this problem (ANDing w/ a term you know to be in all for your docs,
Actually, I started with a simple case to see how it works...
I'm going to add this missing feature to NXLucene
Most of our queries have lots of clauses, so that won't be an issue.
I'll probably throw a MatchAllDocs in (if useful only of course)
> You could also enumerate all of the other values of the status
> field w/ OR
> (assuming you know all of them ahead of time).
FTR, that's precisely what I couldn't do. The first concrete use-case
will be to hide documents
from a few users among a lot...
Georges Racinet, Nuxeo SAS
Open Source Enterprise Content Management (ECM)
Web: http://www.nuxeo.com/ and http://www.nuxeo.org/ - Tel: +33 1 40
33 79 87
More information about the pylucene-dev