Excerpts from Marcus Williams's message of Wed Nov 07 13:09:10 -0800 2007:
> Is there any way to get the new message count without search for
> unread labels?
Nope. Unread is just another label, so you've got to do the search.
> How fast is that in ferret?
Pretty fast!
$ sh devel/console.sh
[Wed Nov 07 15:03:42 -0800 2007] loading index...
[Wed Nov 07 15:03:42 -0800 2007] loaded index of 65765 messages
>> require 'benchmark'
>> all = "+label:unread -label:deleted -label:killed -label:spam"
>> inbox = all + " +label:inbox"
>> puts Benchmark.measure { Index.ferret.search(all).total_hits }
0.020000 0.000000 0.020000 ( 0.015534)
>> Index.ferret.search(all).total_hits
=> 57551
>> puts Benchmark.measure { Index.ferret.search(inbox).total_hits }
=> nil
>> Index.ferret.search(inbox).total_hits
=> 13
The number in parentheses is elapsed real time. Probably fast enough to
call on every keypress, but feel free to cache it if you like.
> What happens if your result set has 60k messages in it, does it chew
> memory?
Nope. Play around with the methods above. Ferret is pretty good about
this.
> I cant imagine having 60k new messages, but on initial sup-sync you
> might on a big mailbox.
As you can see above, 57k of the 66k messages in my index are new.
(It's the last few years of ruby-talk.) Have I blown your mind? :)
--
William <[EMAIL PROTECTED]>
_______________________________________________
sup-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/sup-talk