]> git.cworth.org Git - sup/commitdiff
fixed num_results_for
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Sat, 30 Dec 2006 15:34:23 +0000 (15:34 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Sat, 30 Dec 2006 15:34:23 +0000 (15:34 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@126 5c8cc53c-5e98-4d25-b20a-d8db53a31250

lib/sup/index.rb

index fedef3ce9a9f40759248af9f2b4142d6401f5f24..4002c7dd9c19b602953b9cec3031ec844f36f69d 100644 (file)
@@ -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