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 <[email protected]>
_______________________________________________
sup-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/sup-talk

Reply via email to