test/boost_test.rb in searchkick-2.3.1 vs test/boost_test.rb in searchkick-2.3.2
- old
+ new
@@ -114,9 +114,24 @@
]
assert_order "tomato", ["Tomato C", "Tomato B", "Tomato A"], boost_by: [:orders_count]
assert_order "tomato", ["Tomato C", "Tomato B", "Tomato A"], boost_by: {orders_count: {factor: 10}}
end
+ def test_boost_by_missing
+ store [
+ {name: "Tomato A"},
+ {name: "Tomato B", orders_count: 10},
+ ]
+
+ if elasticsearch_below50?
+ assert_raises(ArgumentError) do
+ assert_order "tomato", ["Tomato A", "Tomato B"], boost_by: {orders_count: {missing: 100}}
+ end
+ else
+ assert_order "tomato", ["Tomato A", "Tomato B"], boost_by: {orders_count: {missing: 100}}
+ end
+ end
+
def test_boost_by_boost_mode_multiply
store [
{name: "Tomato A", found_rate: 0.9},
{name: "Tomato B"},
{name: "Tomato C", found_rate: 0.5}