Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#157 closed defect (released)

Boolean filters shouldn't always combine with AND

Reported by: Richard Boulton Owned by: Olly Betts
Priority: normal Milestone:
Component: QueryParser Version: SVN trunk
Severity: normal Keywords:
Cc: Andreas Marienborg Blocked By:
Blocking: Operating System: All

Description

Currently, the query parser always combines boolean filter terms together with AND. In addition, it doesn't handle explicit boolean operators usefully (the result is sometimes useful, but not consistently).

The query parser should be modified to combine boolean filter terms with the same prefix together with OR, and then combine those groups with different prefixes together with AND. The query parser should also respect explicit operators, such that (where a and b are boolean prefixes for A and B).

"a:foo a:bar" becomes "Afoo OR Abar" "a:foo b:bar" becomes "Afoo AND Bbar" "a:foo AND a:bar" becomes "Afoo AND Abar" "a:foo OR b:bar" becomes "Afoo OR Abar"

A tricky case is:

"foo OR a:bar" - this could become "foo OR Abar", but the resulting weights may not be useful.

Attachments (6)

patch1 (1.7 KB ) - added by Richard Boulton 18 years ago.
Patch adding relevant tests to queryparsertest
patch1.2 (6.9 KB ) - added by Richard Boulton 18 years ago.
Implementation of ORring filter terms with the same prefix
boolgroups.patch (11.4 KB ) - added by Richard Boulton 18 years ago.
Updated implementation of ORring filter terms with the same prefix
boolgroups.2.patch (10.9 KB ) - added by Richard Boulton 18 years ago.
Further updated patch
boolgroups.3.patch (10.0 KB ) - added by Richard Boulton 18 years ago.
Further update to patch
boolgroups.4.patch (11.6 KB ) - added by Richard Boulton 18 years ago.
Further update - adds documentation and a test case

Download all attachments as: .zip

Change History (14)

by Richard Boulton, 18 years ago

Attachment: patch1 added

Patch adding relevant tests to queryparsertest

comment:1 by Richard Boulton, 18 years ago

attachments.isobsolete: 01

comment:2 by Richard Boulton, 18 years ago

Note - Olly pointed out that the patch doesn't handle value range filters correctly (since these don't have a prefix - instead having a slot number).

There's also the issue about what to do about prefixes which have multiple names

  • eg, if add_prefix('author', 'A') and add_prefix('writer', 'A') have been

called, what should "author:foo writer:bar" produce? I'm tending towards thinking that "Afoo AND Abar" is appropriate, mainly because it's easier to document, but I'm not fully convinced.

comment:3 by Andreas Marienborg, 18 years ago

Cc: andreas@… added

by Richard Boulton, 18 years ago

Attachment: patch1.2 added

Implementation of ORring filter terms with the same prefix

comment:4 by Richard Boulton, 18 years ago

attachments.isobsolete: 01

by Richard Boulton, 18 years ago

Attachment: boolgroups.patch added

Updated implementation of ORring filter terms with the same prefix

comment:5 by Richard Boulton, 18 years ago

attachments.isobsolete: 01

by Richard Boulton, 18 years ago

Attachment: boolgroups.3.patch added

Further updated patch

comment:6 by Richard Boulton, 18 years ago

attachments.isobsolete: 01

by Richard Boulton, 18 years ago

Attachment: boolgroups.4.patch added

Further update - adds documentation and a test case

comment:7 by Richard Boulton, 18 years ago

attachments.isobsolete: 01

comment:8 by Olly Betts, 18 years ago

Resolution: fixed
Status: newclosed

Patch applied, so fixed in SVN HEAD.

comment:9 by Olly Betts, 18 years ago

Operating System: All
Resolution: fixedreleased

Fixed in 1.0.1.

Note: See TracTickets for help on using tickets.