test/boost_test.rb in searchkick-2.4.0 vs test/boost_test.rb in searchkick-2.5.0
- old
+ new
@@ -189,9 +189,20 @@
{name: "San Marino", latitude: 43.9333, longitude: 12.4667}
]
assert_order "san", ["San Francisco", "San Antonio", "San Marino"], boost_by_distance: {location: {origin: {lat: 37, lon: -122}, scale: "1000mi"}}
end
+ def test_boost_by_distance_v2_factor
+ store [
+ {name: "San Francisco", latitude: 37.7833, longitude: -122.4167, found_rate: 0.1},
+ {name: "San Antonio", latitude: 29.4167, longitude: -98.5000, found_rate: 0.99},
+ {name: "San Marino", latitude: 43.9333, longitude: 12.4667, found_rate: 0.2}
+ ]
+
+ assert_order "san", ["San Antonio","San Francisco", "San Marino"], boost_by: {found_rate: {factor: 100}}, boost_by_distance: {location: {origin: [37, -122], scale: "1000mi"}}
+ assert_order "san", ["San Francisco", "San Antonio", "San Marino"], boost_by: {found_rate: {factor: 100}}, boost_by_distance: {location: {origin: [37, -122], scale: "1000mi", factor: 100}}
+ end
+
def test_boost_by_indices
skip if cequel?
store_names ["Rex"], Animal
store_names ["Rexx"], Product