Commit 9b369bd6c4c656c56df329eee01c6cdc060eabcf

Authored by Andrew Kane
1 parent 974d24a3

Added misspellings

lib/searchkick/relation.rb
... ... @@ -336,6 +336,15 @@ module Searchkick
336 336 self
337 337 end
338 338  
  339 + def misspellings(value)
  340 + spawn.misspellings!(value)
  341 + end
  342 +
  343 + def misspellings!(value)
  344 + options[:misspellings] = value
  345 + self
  346 + end
  347 +
339 348 # same as Active Record
340 349 def inspect
341 350 entries = results.first(11).map!(&:inspect)
... ...
test/misspellings_test.rb
... ... @@ -4,6 +4,7 @@ class MisspellingsTest < Minitest::Test
4 4 def test_misspellings
5 5 store_names ["abc", "abd", "aee"]
6 6 assert_search "abc", ["abc"], misspellings: false
  7 + assert_search_relation ["abc"], Product.search("abc", relation: true).misspellings(false)
7 8 end
8 9  
9 10 def test_misspellings_distance
... ...