Commit 0b167531d559953ddf45f57723e982c45b36b78e
1 parent
def69a7c
Exists in
master
and in
19 other branches
Missing param supported >= es 5.0
Showing
2 changed files
with
13 additions
and
1 deletions
Show diff stats
lib/searchkick/query.rb
test/boost_test.rb
... | ... | @@ -114,9 +114,21 @@ 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 | + end | |
118 | + | |
119 | + def test_boost_by_missing_field | |
120 | + skip if elasticsearch_below50? | |
121 | + | |
122 | + store [ | |
123 | + {name: "Tomato A"}, | |
124 | + {name: "Tomato B", orders_count: 10}, | |
125 | + {name: "Tomato C", orders_count: 100} | |
126 | + ] | |
127 | + | |
117 | 128 | assert_raises(Searchkick::InvalidQueryError) do |
118 | 129 | assert_order "tomato", ["Tomato C", "Tomato B", "Tomato A"], boost_by: {orders_count: {factor: 5}, orders_value: {factor: 5}} |
119 | 130 | end |
131 | + | |
120 | 132 | assert_order "tomato", ["Tomato C", "Tomato B", "Tomato A"], boost_by: {orders_count: {factor: 5}, orders_value: {factor: 5, missing: 1}} |
121 | 133 | end |
122 | 134 | ... | ... |