Commit d1bafaaa9641a476aa708673734c6c8163fd4d5f
1 parent
de10fd0b
Exists in
master
and in
21 other branches
Better or
Showing
3 changed files
with
6 additions
and
5 deletions
Show diff stats
README.md
lib/searchkick/search.rb
... | ... | @@ -55,7 +55,9 @@ module Searchkick |
55 | 55 | # where |
56 | 56 | (options[:where] || {}).each do |k, v| |
57 | 57 | if k == :or |
58 | - filter :or, v.map{|v2| {term: v2} } | |
58 | + v.each do |v2| | |
59 | + filter :or, v2.map{|v3| {term: v3} } | |
60 | + end | |
59 | 61 | else |
60 | 62 | if v.is_a?(Range) |
61 | 63 | v = {gte: v.first, (v.exclude_end? ? :lt : :lte) => v.last} | ... | ... |
test/searchkick_test.rb
... | ... | @@ -238,7 +238,7 @@ class TestSearchkick < Minitest::Unit::TestCase |
238 | 238 | assert_search "product", ["Product A", "Product B"], where: {store_id: [1, 2]} |
239 | 239 | assert_search "product", ["Product B", "Product C", "Product D"], where: {store_id: {not: 1}} |
240 | 240 | assert_search "product", ["Product C", "Product D"], where: {store_id: {not: [1, 2]}} |
241 | - assert_search "product", ["Product A", "Product B", "Product C"], where: {or: [{in_stock: true}, {store_id: 3}]} | |
241 | + assert_search "product", ["Product A", "Product B", "Product C"], where: {or: [[{in_stock: true}, {store_id: 3}]]} | |
242 | 242 | end |
243 | 243 | |
244 | 244 | def test_order | ... | ... |