[Wishlist bug] Query parser should allow pure NOT queries
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)
Component: |
Other → QueryParser
|
op_sys: |
Linux → All
|
rep_platform: |
PC → All
|
Severity: |
normal → enhancement
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
Operating System: |
→ All
|
Resolution: |
fixed → released
|
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?