From 53aa0a1b541108dae11f29225020990b8e2a0ced Mon Sep 17 00:00:00 2001 From: Filip Bachul Date: Thu, 30 Mar 2023 23:17:34 +0200 Subject: [PATCH 1/3] handle _geo(x,x) sort error --- milli/src/asc_desc.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/milli/src/asc_desc.rs b/milli/src/asc_desc.rs index bbc49ea7d..7770f5b35 100644 --- a/milli/src/asc_desc.rs +++ b/milli/src/asc_desc.rs @@ -81,6 +81,7 @@ impl FromStr for Member { if is_reserved_keyword(text) || text.starts_with("_geoRadius(") || text.starts_with("_geoBoundingBox(") + || text.starts_with("_geo(") { return Err(AscDescError::ReservedKeyword { name: text.to_string() })?; } @@ -265,6 +266,8 @@ mod tests { ("_geoPoint(0, -180.000001):desc", GeoError(BadGeoError::Lng(-180.000001))), ("_geoPoint(159.256, 130):asc", GeoError(BadGeoError::Lat(159.256))), ("_geoPoint(12, -2021):desc", GeoError(BadGeoError::Lng(-2021.))), + ("_geo(12, -2021):asc", ReservedKeyword { name: S("_geo(12, -2021)") }), + ("_geo(12, -2021):desc", ReservedKeyword { name: S("_geo(12, -2021)") }), ]; for (req, expected_error) in invalid_req { From cb2b5eb38e6b43294e90289f57988ae8e915a265 Mon Sep 17 00:00:00 2001 From: Filip Bachul Date: Thu, 30 Mar 2023 23:21:23 +0200 Subject: [PATCH 2/3] handle _geoDistance(x,x) sort error --- milli/src/asc_desc.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/milli/src/asc_desc.rs b/milli/src/asc_desc.rs index 7770f5b35..038738b97 100644 --- a/milli/src/asc_desc.rs +++ b/milli/src/asc_desc.rs @@ -82,6 +82,7 @@ impl FromStr for Member { || text.starts_with("_geoRadius(") || text.starts_with("_geoBoundingBox(") || text.starts_with("_geo(") + || text.starts_with("_geoDistance(") { return Err(AscDescError::ReservedKeyword { name: text.to_string() })?; } @@ -268,6 +269,8 @@ mod tests { ("_geoPoint(12, -2021):desc", GeoError(BadGeoError::Lng(-2021.))), ("_geo(12, -2021):asc", ReservedKeyword { name: S("_geo(12, -2021)") }), ("_geo(12, -2021):desc", ReservedKeyword { name: S("_geo(12, -2021)") }), + ("_geoDistance(12, -2021):asc", ReservedKeyword { name: S("_geoDistance(12, -2021)") }), + ("_geoDistance(12, -2021):desc", ReservedKeyword { name: S("_geoDistance(12, -2021)") }), ]; for (req, expected_error) in invalid_req { From 1861c69964ae54572be1eb3265f9f68c1bee0d7b Mon Sep 17 00:00:00 2001 From: Filip Bachul Date: Thu, 30 Mar 2023 23:37:26 +0200 Subject: [PATCH 3/3] fmt --- milli/src/asc_desc.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/milli/src/asc_desc.rs b/milli/src/asc_desc.rs index 038738b97..bde0dd440 100644 --- a/milli/src/asc_desc.rs +++ b/milli/src/asc_desc.rs @@ -270,7 +270,10 @@ mod tests { ("_geo(12, -2021):asc", ReservedKeyword { name: S("_geo(12, -2021)") }), ("_geo(12, -2021):desc", ReservedKeyword { name: S("_geo(12, -2021)") }), ("_geoDistance(12, -2021):asc", ReservedKeyword { name: S("_geoDistance(12, -2021)") }), - ("_geoDistance(12, -2021):desc", ReservedKeyword { name: S("_geoDistance(12, -2021)") }), + ( + "_geoDistance(12, -2021):desc", + ReservedKeyword { name: S("_geoDistance(12, -2021)") }, + ), ]; for (req, expected_error) in invalid_req {