From mboxrd@z Thu Jan 1 00:00:00 1970 From: olly@survex.com (Olly Betts) Date: Tue, 28 Jul 2009 16:53:46 +0000 (UTC) Subject: [sup-talk] [PATCH 0/18] Xapian-based index References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu> <1245854803-sup-4481@entry> <1245864733-sup-1216@entry> <1246022094-sup-3336@entry> <1247873980-sup-8574@wrasse> <20090723102325.GA4291@chistera.yi.org> <1248497184-sup-939@pion.club.cc.cmu.edu> <1248709366-sup-5856@entry> Message-ID: William Morgan writes: > Reformatted excerpts from Rich Lane's message of 2009-07-24: > > You need to specify a non-negated term in the query. "type:mail > > -label:inbox" should work. > > This is a typical restriction for inverted index-based search engines. > You need to have at least one positive term or the computation is too > expensive (it would have to iterate over every term ever seen.) It's > true of Ferret, Google, etc. Actually, Xapian supports this - Xapian.Query.new("") is a "magic" query which matches all documents. It doesn't need to iterate over every term, just all documents. But if you want the top ten documents without a particular filter, there's no relevance ranking, so it can stop after it has found ten matches, which should be pretty quick. This isn't currently supported by the QueryParser when using "-" on terms (the reasoning was that it was too easy to accidentally invoke when pasting text), but 'NOT label:inbox' will work if you enable it using QueryParser.FLAG_PURE_NOT. Cheers, Olly