QueryParser should have option to combine same-prefix filters with OP_AND
|Reported by:||Olly Betts||Owned by:||Olly Betts|
#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.