Commit 79574478bee4f1e4f75026140e212bdf6376fb8f
1 parent
f6f6b16d
Exists in
master
and in
5 other branches
Updated readme and tests for deprecated geo_polygon filter
Showing
3 changed files
with
6 additions
and
2 deletions
Show diff stats
README.md
@@ -939,7 +939,7 @@ Restaurant.search "sushi", where: {location: {top_left: {lat: 38, lon: -123}, bo | @@ -939,7 +939,7 @@ Restaurant.search "sushi", where: {location: {top_left: {lat: 38, lon: -123}, bo | ||
939 | Bounded by a polygon | 939 | Bounded by a polygon |
940 | 940 | ||
941 | ```ruby | 941 | ```ruby |
942 | -Restaurant.search "dessert", where: {location: {geo_polygon: {points: [{lat: 38, lon: -123}, {lat: 39, lon: -123}, {lat: 37, lon: 122}]}}} | 942 | +Restaurant.search "dessert", where: {location: {geo_shape: {type: "polygon", coordinates: [[{lat: 38, lon: -123}, {lat: 39, lon: -123}, {lat: 37, lon: 122}, {lat: 38, lon: -123}]]}}} |
943 | ``` | 943 | ``` |
944 | 944 | ||
945 | ### Boost By Distance | 945 | ### Boost By Distance |
test/geo_shape_test.rb
@@ -118,7 +118,7 @@ class GeoShapeTest < Minitest::Test | @@ -118,7 +118,7 @@ class GeoShapeTest < Minitest::Test | ||
118 | } | 118 | } |
119 | end | 119 | end |
120 | 120 | ||
121 | - def test_search_math | 121 | + def test_search_match |
122 | assert_search "witch", ["Region A"], { | 122 | assert_search "witch", ["Region A"], { |
123 | where: { | 123 | where: { |
124 | territory: { | 124 | territory: { |
test/where_test.rb
@@ -297,6 +297,10 @@ class WhereTest < Minitest::Test | @@ -297,6 +297,10 @@ class WhereTest < Minitest::Test | ||
297 | unless Searchkick.server_below?("7.12.0") | 297 | unless Searchkick.server_below?("7.12.0") |
298 | assert_match "Deprecated field [geo_polygon] used", stderr | 298 | assert_match "Deprecated field [geo_polygon] used", stderr |
299 | end | 299 | end |
300 | + | ||
301 | + # see test/geo_shape_test.rb for other geo_shape tests | ||
302 | + polygon << polygon.first | ||
303 | + assert_search "san", ["San Francisco", "San Antonio"], where: {location: {geo_shape: {type: "polygon", coordinates: [polygon]}}} | ||
300 | end | 304 | end |
301 | 305 | ||
302 | def test_top_left_bottom_right | 306 | def test_top_left_bottom_right |