Opened 18 years ago

Closed 17 years ago

Last modified 17 years ago

#99 closed enhancement (released)

[Wishlist bug] Query parser should allow pure NOT queries

Reported by: Richard Boulton Owned by: Richard Boulton
Priority: lowest Milestone:
Component: QueryParser Version: SVN trunk
Severity: minor Keywords:
Cc: Blocked By: #47
Blocking: Operating System: All

Description

Searches like "NOT apples" or "-pears" should be allowed. These can be implemented by using an all-document iterator (once these are added to the xapian-core) as the left-hand side of the ANDNOT operator.

It should probably be possible to disable this feature using a query parser flag, and it should possibly be disabled by default, since it could result in slow searches (all documents in the database will be searched, by default).

One thing to ponder: if the default operator is OR, should searches like "a (NOT b)" be parsed as "a ANDNOT b", or as "a OR (ALLDOCS ANDNOT b)". (If the default operator is AND, "a AND (ALLDOCS ANDNOT b)" is equivalent to "a ANDNOT b".)

Change History (7)

comment:1 by Richard Boulton, 18 years ago

Blocked By: 47 added

comment:2 by Richard Boulton, 18 years ago

Status: newassigned

comment:3 by Olly Betts, 17 years ago

I've now implemented "NOT apples" in SVN trunk.

Currently it's always enabled, though I agree it probably ought to be disabled by default. I wondered whether we should test to see if it's actually expensive, but I'm fairly convinced it will be.

There's a queryparser testcase which checks we get the Query object we expect, but no test that the query generated actually produces the expected results currently.

I've not implemented this for "-pears" so far - I'm a bit dubious that this is really a good idea. Do you know of another search system which implements it?

comment:4 by Olly Betts, 17 years ago

Component: OtherQueryParser
op_sys: LinuxAll
rep_platform: PCAll
Severity: normalenhancement

comment:5 by Olly Betts, 17 years ago

Now controlled by QueryParser::FLAG_PURE_NOT and off by default.

comment:6 by Olly Betts, 17 years ago

Resolution: fixed
Status: assignedclosed

IRL, Richard agreed that "pure minus" queries probably aren't useful, so closing this bug.

comment:7 by Olly Betts, 17 years ago

Operating System: All
Resolution: fixedreleased

Fixed in 1.0.0 release.

Note: See TracTickets for help on using tickets.