Commit 478d5fccb6ac18e4c08889d27de557f0fdc04a8d

Authored by Andrew Kane
1 parent d0637c39

Added limit, offset, and explain

lib/searchkick/search.rb
@@ -35,6 +35,9 @@ module Searchkick @@ -35,6 +35,9 @@ module Searchkick
35 end 35 end
36 end 36 end
37 end 37 end
  38 + size options[:limit] if options[:limit]
  39 + from options[:offset] if options[:offset]
  40 + explain options[:explain] if options[:explain]
38 end 41 end
39 end 42 end
40 end 43 end
test/searchkick_test.rb
@@ -183,6 +183,21 @@ class TestSearchkick < Minitest::Unit::TestCase @@ -183,6 +183,21 @@ class TestSearchkick < Minitest::Unit::TestCase
183 assert_search "zero", ["Zero Boost A", "Zero Boost B", "Zero Boost C"] 183 assert_search "zero", ["Zero Boost A", "Zero Boost B", "Zero Boost C"]
184 end 184 end
185 185
  186 + # search method
  187 +
  188 + def test_limit
  189 + store_names ["Product A", "Product B"]
  190 + assert_equal 1, Product.search("Product", limit: 1).size
  191 + end
  192 +
  193 + def test_offset
  194 + store_names ["Product A", "Product B"]
  195 + assert_equal 1, Product.search("Product", offset: 1).size
  196 + end
  197 +
  198 + def test_where
  199 + end
  200 +
186 protected 201 protected
187 202
188 def store(documents) 203 def store(documents)