test/boost_test.rb in searchkick-0.8.5 vs test/boost_test.rb in searchkick-0.8.6
- old
+ new
@@ -73,10 +73,18 @@
{name: "White", color: "Red Red Red"}
]
assert_order "red", ["Red", "White"], fields: ["name^10", "color"]
end
+ def test_boost_fields_decimal
+ store [
+ {name: "Red", color: "White"},
+ {name: "White", color: "Red Red Red"}
+ ]
+ assert_order "red", ["Red", "White"], fields: ["name^10.5", "color"]
+ end
+
def test_boost_fields_word_start
store [
{name: "Red", color: "White"},
{name: "White", color: "Red Red Red"}
]
@@ -94,15 +102,17 @@
end
def test_boost_where
store [
{name: "Tomato A"},
- {name: "Tomato B", user_ids: [1, 2, 3]},
- {name: "Tomato C"},
- {name: "Tomato D"}
+ {name: "Tomato B", user_ids: [1, 2]},
+ {name: "Tomato C", user_ids: [3]}
]
assert_first "tomato", "Tomato B", boost_where: {user_ids: 2}
+ assert_first "tomato", "Tomato B", boost_where: {user_ids: [1, 4]}
assert_first "tomato", "Tomato B", boost_where: {user_ids: {value: 2, factor: 10}}
+ assert_first "tomato", "Tomato B", boost_where: {user_ids: {value: [1, 4], factor: 10}}
+ assert_order "tomato", ["Tomato C", "Tomato B", "Tomato A"], boost_where: {user_ids: [{value: 1, factor: 10}, {value: 3, factor: 20}]}
end
def test_boost_by_distance
store [
{name: "San Francisco", latitude: 37.7833, longitude: -122.4167},