[Xapian-tickets] [Xapian] #402: QueryParser should have option to combine same-prefix filters with OP_AND
Xapian
nobody at xapian.org
Mon Sep 14 15:57:26 BST 2009
#402: QueryParser should have option to combine same-prefix filters with OP_AND
-------------------------+--------------------------------------------------
Reporter: olly | Owner: olly
Type: defect | Status: new
Priority: normal | Milestone: 1.2.0
Component: QueryParser | Version: 1.0.16
Severity: normal | Keywords:
Blockedby: | Platform: All
Blocking: |
-------------------------+--------------------------------------------------
Thread: http://thread.gmane.org/gmane.comp.search.xapian.general/7720
Summary;
#157 changed !QueryParser to combine boolean filters with the same prefix
with OP_AND rather than OP_OR - the rationale being that for filters like
"file type", type:pdf type:html would match no documents, so the sane
interpretation is to pick either type.
However, this overlooks cases where a document can have multiple
attributes of the same sort in some cases. The example in the thread is
user tags - label:foo label:starred - and then it's
generally more logical to use OP_AND.
This probably should be controllable on a per-prefix basis. In
cases where each document can only have a single attribute from a set
(like "hostname" or "mime type") then the current behaviour is great (and
AND makes no sense as no document could match) but if each document can
have multiple attributes from the set then it's likely that AND is a
better default.
This could be specified in the API when the prefix is set, something like:
QueryParser::add_boolean_prefix(const std::string &field, const
std::string &prefix, Xapian::Query::op op)
This should just be an API addition which can be made in an ABI compatible
way, so marking for 1.2.x.
--
Ticket URL: <http://trac.xapian.org/ticket/402>
Xapian <http://xapian.org/>
Xapian
More information about the Xapian-tickets
mailing list