From 36379b8ab24cfcf505631aff155dd758ae229458 Mon Sep 17 00:00:00 2001 From: wmorgan Date: Sat, 30 Dec 2006 15:34:23 +0000 Subject: [PATCH] fixed num_results_for git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@126 5c8cc53c-5e98-4d25-b20a-d8db53a31250 --- lib/sup/index.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/sup/index.rb b/lib/sup/index.rb index fedef3c..4002c7d 100644 --- a/lib/sup/index.rb +++ b/lib/sup/index.rb @@ -125,7 +125,9 @@ class Index end def num_results_for opts={} - with(build_query(opts)) { |query| with(@index.search(query).total_hits) { |x| Redwood::log "num_results_for: have #{x} for query #{query}" } } + return 0 if @index.size == 0 # otherwise ferret barfs ###TODO: remove this once my ferret patch is accepted + q = build_query opts + index.search(q).total_hits end ## yield all messages in the thread containing 'm' by repeatedly -- 2.45.2