Permalink
Browse files

make reported total include relevance limit

  • Loading branch information...
1 parent ffee5f0 commit 33876aecd107afa010190e97a39fdb822ee4931a @drmitten drmitten committed Sep 26, 2012
Showing with 2 additions and 0 deletions.
  1. +1 −0 lib/xapit/server/query.rb
  2. +1 −0 spec/xapit/server/query_spec.rb
@@ -78,6 +78,7 @@ def facet_option(identifier)
def total
enquire = Xapian::Enquire.new(Xapit.database.xapian_database)
enquire.query = xapian_query
+ enquire.cutoff!(min_relevance) if min_relevance
enquire.mset(0, Xapit.database.xapian_database.doccount).matches_estimated
end
@@ -19,6 +19,7 @@
Xapit.database.add_document(:attributes => {:greeting => {:value => "world", :text => {}}}, :id => 3, :class => "Greeting")
query = Xapit::Server::Query.new([{:search => "hello"}, {:or_search => "world"}, {:min_relevance => 50}])
query.records.map{|r| r[:id]}.should == ["1"]
+ query.total.should == 1
end
it "fetches facets when told to include them" do

0 comments on commit 33876ae

Please sign in to comment.