From mboxrd@z Thu Jan 1 00:00:00 1970 From: wmorgan-sup@masanjin.net (William Morgan) Date: Mon, 18 May 2009 11:31:35 -0700 Subject: [sup-talk] Notification tools In-Reply-To: <1242265757-sup-2754@entry> References: <1242213878-sup-4217@ptoseis> <1242239740-sup-8633@entry> <391beaa80905131723k4b59090bi5bd541d97d1a75f2@mail.gmail.com> <1242261120-sup-2999@cabinet> <1242265757-sup-2754@entry> Message-ID: <1242671206-sup-2630@entry> Reformatted excerpts from William Morgan's message of 2009-05-13: > require 'sup' > i = Redwood::Index.new > i.load > puts "total unread: " + i.ferret.search("label:unread").total_hits > puts "inbox unread: " + i.ferret.search("label:unread AND > label:inbox").total_hits In the parser-user-query-fix branch (merged into next), you can now use Index.run_query, which takes a query and returns an array of doc ids. So you can now do this: require 'sup' i = Redwood::Index.new i.load puts "total unread: " + i.run_query("label:unread").size.to_s puts "inbox unread: " + i.run_query("label:unread AND label:inbox").size.to_s which has the same effect as above, but now you should be able to pass in all the fancy options you can use on the search line (from:/to: with contacts, :limit, date options if you have chronic installed, etc). -- William