Commit 974d24a36ab33b9e22e7fd53380c4fb6ce23ec82

Authored by Andrew Kane
1 parent 41eacc66

Allow array [skip ci]

@@ -415,7 +415,7 @@ exclude_queries = { @@ -415,7 +415,7 @@ exclude_queries = {
415 "cream" => ["ice cream", "whipped cream"] 415 "cream" => ["ice cream", "whipped cream"]
416 } 416 }
417 417
418 -Product.search(query).exclude(*exclude_queries[query]) 418 +Product.search(query).exclude(exclude_queries[query])
419 ``` 419 ```
420 420
421 You can demote results by boosting by a factor less than one: 421 You can demote results by boosting by a factor less than one:
lib/searchkick/relation.rb
@@ -332,7 +332,7 @@ module Searchkick @@ -332,7 +332,7 @@ module Searchkick
332 end 332 end
333 333
334 def exclude!(*args) 334 def exclude!(*args)
335 - options[:exclude] = Array(options[:exclude]) + args 335 + options[:exclude] = Array(options[:exclude]) + args.flatten
336 self 336 self
337 end 337 end
338 338
test/match_test.rb
@@ -176,6 +176,7 @@ class MatchTest < Minitest::Test @@ -176,6 +176,7 @@ class MatchTest < Minitest::Test
176 store_names ["Butter Tub", "Peanut Butter Tub"] 176 store_names ["Butter Tub", "Peanut Butter Tub"]
177 assert_search "butter", ["Butter Tub"], exclude: ["peanut butter"] 177 assert_search "butter", ["Butter Tub"], exclude: ["peanut butter"]
178 assert_search_relation ["Butter Tub"], Product.search("butter", relation: true).exclude("peanut butter") 178 assert_search_relation ["Butter Tub"], Product.search("butter", relation: true).exclude("peanut butter")
  179 + assert_search_relation ["Butter Tub"], Product.search("butter", relation: true).exclude(["peanut butter"])
179 end 180 end
180 181
181 def test_exclude_butter_word_start 182 def test_exclude_butter_word_start