Commit e406fab179197a73ff1694e4c09c8ee79b3a60a8
1 parent
982dbe11
Exists in
master
and in
18 other branches
Added total_entries option [skip ci]
Showing
4 changed files
with
10 additions
and
3 deletions
Show diff stats
CHANGELOG.md
lib/searchkick/query.rb
... | ... | @@ -19,7 +19,7 @@ module Searchkick |
19 | 19 | :boost_by, :boost_by_distance, :boost_by_recency, :boost_where, :conversions, :conversions_term, :debug, :emoji, :exclude, :execute, :explain, |
20 | 20 | :fields, :highlight, :includes, :index_name, :indices_boost, :limit, :load, |
21 | 21 | :match, :misspellings, :model_includes, :offset, :operator, :order, :padding, :page, :per_page, :profile, |
22 | - :request_params, :routing, :scope_results, :select, :similar, :smart_aggs, :suggest, :track, :type, :where] | |
22 | + :request_params, :routing, :scope_results, :select, :similar, :smart_aggs, :suggest, :total_entries, :track, :type, :where] | |
23 | 23 | raise ArgumentError, "unknown keywords: #{unknown_keywords.join(", ")}" if unknown_keywords.any? |
24 | 24 | |
25 | 25 | term = term.to_s |
... | ... | @@ -116,7 +116,8 @@ module Searchkick |
116 | 116 | misspellings: @misspellings, |
117 | 117 | term: term, |
118 | 118 | scope_results: options[:scope_results], |
119 | - index_name: options[:index_name] | |
119 | + index_name: options[:index_name], | |
120 | + total_entries: options[:total_entries] | |
120 | 121 | } |
121 | 122 | |
122 | 123 | if options[:debug] | ... | ... |
lib/searchkick/results.rb
test/pagination_test.rb
... | ... | @@ -77,6 +77,11 @@ class PaginationTest < Minitest::Test |
77 | 77 | assert products.first_page? |
78 | 78 | end |
79 | 79 | |
80 | + def test_total_entries | |
81 | + products = Product.search("product", total_entries: 4) | |
82 | + assert_equal 4, products.total_entries | |
83 | + end | |
84 | + | |
80 | 85 | def test_kaminari |
81 | 86 | skip unless defined?(Kaminari) |
82 | 87 | ... | ... |