Commit ae7c984766e1839e5539cb02f47cd983b2a9624b
1 parent
bdf36fcd
Exists in
master
and in
21 other branches
Use in filter - closes #391
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
lib/searchkick/query.rb
@@ -524,10 +524,10 @@ module Searchkick | @@ -524,10 +524,10 @@ module Searchkick | ||
524 | 524 | ||
525 | def term_filters(field, value) | 525 | def term_filters(field, value) |
526 | if value.is_a?(Array) # in query | 526 | if value.is_a?(Array) # in query |
527 | - if value.any? | 527 | + if value.any?(&:nil?) |
528 | {or: value.map{|v| term_filters(field, v) }} | 528 | {or: value.map{|v| term_filters(field, v) }} |
529 | else | 529 | else |
530 | - {terms: {field => value}} # match nothing | 530 | + {in: {field => value}} |
531 | end | 531 | end |
532 | elsif value.nil? | 532 | elsif value.nil? |
533 | {missing: {"field" => field, existence: true, null_value: true}} | 533 | {missing: {"field" => field, existence: true, null_value: true}} |