Ticket #99 (closed enhancement: released)

Opened 2 years ago

Last modified 19 months ago

[Wishlist bug] Query parser should allow pure NOT queries

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

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

Changed 2 years ago by richard

  • blockedby set to 47

Changed 2 years ago by richard

  • status changed from new to assigned

Changed 2 years ago by olly

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?

Changed 2 years ago by olly

  • rep_platform changed from PC to All
  • component changed from Other to QueryParser
  • op_sys changed from Linux to All
  • severity changed from normal to enhancement

Changed 2 years ago by olly

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

Changed 2 years ago by olly

  • status changed from assigned to closed
  • resolution set to fixed

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

Changed 19 months ago by olly

  • resolution changed from fixed to released

Fixed in 1.0.0 release.

Changed 19 months ago by trac

  • platform set to All
Note: See TracTickets for help on using tickets.