Commit def69a7cd06a28a48fec772546b6fe675442618a
1 parent
7b6be02b
Exists in
master
and in
19 other branches
Adds an optional 'missing' param to boost_by
Sets default boost and avoids Searchkick::InvalidQueryError when boosting an unmapped field
Showing
2 changed files
with
8 additions
and
0 deletions
Show diff stats
lib/searchkick/query.rb
test/boost_test.rb
... | ... | @@ -114,6 +114,10 @@ class BoostTest < Minitest::Test |
114 | 114 | ] |
115 | 115 | assert_order "tomato", ["Tomato C", "Tomato B", "Tomato A"], boost_by: [:orders_count] |
116 | 116 | assert_order "tomato", ["Tomato C", "Tomato B", "Tomato A"], boost_by: {orders_count: {factor: 10}} |
117 | + assert_raises(Searchkick::InvalidQueryError) do | |
118 | + assert_order "tomato", ["Tomato C", "Tomato B", "Tomato A"], boost_by: {orders_count: {factor: 5}, orders_value: {factor: 5}} | |
119 | + end | |
120 | + assert_order "tomato", ["Tomato C", "Tomato B", "Tomato A"], boost_by: {orders_count: {factor: 5}, orders_value: {factor: 5, missing: 1}} | |
117 | 121 | end |
118 | 122 | |
119 | 123 | def test_boost_by_boost_mode_multiply | ... | ... |