Permalink
Browse files

caching query count to improve performance (of facets especially)

  • Loading branch information...
1 parent 5832567 commit acac930b0f6a00a97856000dbdbd780eecdcbabc @ryanb committed Jun 16, 2009
Showing with 5 additions and 2 deletions.
  1. +3 −1 CHANGELOG
  2. +2 −1 lib/xapit/query.rb
View
@@ -1,4 +1,6 @@
-* adding Xapit::Config#reload_database method
+* performance improvements
+
+* adding Xapit::Config#close_database method for convenience
*0.2.1* (June 15th, 2009)
View
@@ -43,12 +43,13 @@ def matches(options = {})
def count
# a bit of a hack to get more accurate count estimate
- matchset(:limit => Config.database.doccount).matches_estimated
+ @count ||= matchset(:limit => Config.database.doccount).matches_estimated
end
private
def merge_query(operator, *args)
+ @count = nil
@xapian_query = Xapian::Query.new(xapian_operator(operator), @xapian_query, build_xapian_query(*args)) unless args.first.blank?
self
end

0 comments on commit acac930

Please sign in to comment.