[Xapian-devel] Bug and patch for +terms with wildcards
Olly Betts
olly at survex.com
Sat Dec 9 04:14:18 GMT 2006
On Fri, Dec 08, 2006 at 06:44:56PM -0000, Richard Boulton wrote:
> > I think a better approach would be to allow Xapian::Query() to be
> > composed with other queries. I know we used to allow this and it all
> > got out of hand, but that was because we tried to make it compose in
> > magic ways (e.g. Query() AND X would be X). I'm just proposing that
> > this works in the obvious was for an empty query, and you've already
> > implemented this anyway!
>
> I think the current behaviour of Xapian::Query() is good - it can't be
> composed, it returns an error if you try and use it, but it is useful as a
> placeholder when building up complex queries. It's also not obvious to me
> whether Xapian::Query() should match all documents or no documents
It definitely matches no documents - try it! If you call:
enquire.set_query(Xapian::Query());
Xapian::MSet mset = enquire.get_mset(0, 10);
Then mset.size() is 0.
> it depends whether you're thinking of searches as returning all documents
> which match a query, or thinking of a search as filtering the database to
> remove those documents which don't satisfy a query.
The former is how Xapian works so is the correct mental model to use.
Cheers,
Olly
More information about the Xapian-devel
mailing list