lib/lunar/search.rb in lunar-0.2.0 vs lib/lunar/search.rb in lunar-0.2.1
- old
+ new
@@ -16,9 +16,12 @@
# Default finder, uses Ohm style finding
@finder = lambda { |id| prefix[id] }
end
def results(&block)
+ return [] if sets.empty?
+
+ # TODO : cache this for X seconds, X seconds being customizable
Lunar.redis.zunion dist_key, sets.size, *sets
if block_given?
ResultSet.new(dist_key, &block)
else