Commit 941b7ed3d79354a94ed536fc45c3aba8c808dc02

Authored by Andrew Kane
1 parent 4e8cbc33

Added support for any where conditions with boost where - for #439

Showing 2 changed files with 4 additions and 1 deletions   Show diff stats
lib/searchkick/query.rb
... ... @@ -561,7 +561,9 @@ module Searchkick
561 561  
562 562 def custom_filter(field, value, factor)
563 563 {
564   - filter: term_filters(field, value),
  564 + filter: {
  565 + and: where_filters({field => value})
  566 + },
565 567 boost_factor: factor
566 568 }
567 569 end
... ...
test/boost_test.rb
... ... @@ -108,6 +108,7 @@ class TestBoost < Minitest::Test
108 108 {name: "Tomato C", user_ids: [3]}
109 109 ]
110 110 assert_first "tomato", "Tomato B", boost_where: {user_ids: 2}
  111 + assert_first "tomato", "Tomato B", boost_where: {user_ids: 1..2}
111 112 assert_first "tomato", "Tomato B", boost_where: {user_ids: [1, 4]}
112 113 assert_first "tomato", "Tomato B", boost_where: {user_ids: {value: 2, factor: 10}}
113 114 assert_first "tomato", "Tomato B", boost_where: {user_ids: {value: [1, 4], factor: 10}}
... ...