Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

make reported total include relevance limit

  • Loading branch information...
commit 33876aecd107afa010190e97a39fdb822ee4931a 1 parent ffee5f0
@drmitten drmitten authored
Showing with 2 additions and 0 deletions.
  1. +1 −0  lib/xapit/server/query.rb
  2. +1 −0  spec/xapit/server/query_spec.rb
View
1  lib/xapit/server/query.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
View
1  spec/xapit/server/query_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.