diff --git a/lib/searchkick/results.rb b/lib/searchkick/results.rb index 1a7c7ac..85519c9 100644 --- a/lib/searchkick/results.rb +++ b/lib/searchkick/results.rb @@ -63,6 +63,7 @@ module Searchkick def total_count response["hits"]["total"] end + alias_method :total_entries, :total_count def current_page options[:page] @@ -71,15 +72,12 @@ module Searchkick def per_page options[:per_page] end + alias_method :limit_value, :per_page def total_pages (total_count / per_page.to_f).ceil end - def limit_value - per_page - end - def offset_value current_page * per_page end diff --git a/test/sql_test.rb b/test/sql_test.rb index cad13b2..f1f32cf 100644 --- a/test/sql_test.rb +++ b/test/sql_test.rb @@ -26,6 +26,7 @@ class TestSql < Minitest::Unit::TestCase assert_equal 2, products.per_page assert_equal 3, products.total_pages assert_equal 5, products.total_count + assert_equal 5, products.total_entries assert_equal 2, products.limit_value assert_equal 4, products.offset_value end -- libgit2 0.21.0