You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 21, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: text/0059-geo-search.md
+3-31Lines changed: 3 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ The purpose of this specification is to add a first iteration of the **geosearch
15
15
16
16
- Documents MUST have a `_geo` reserved object to be geosearchable.
17
17
- Filter documents by a given geo radius using the built-in filter `_geoRadius({lat}, {lng}, {distance_in_meters})`. It is possible to cumulate several geosearch filters within the `filter` field.
18
-
- Sort documents in ascending order around a geo point. e.g. `_geoPoint({lat}, {lng}):asc`. Descending order will not be supported for this first iteration.
18
+
- Sort documents in ascending/descending order around a geo point. e.g. `_geoPoint({lat}, {lng}):asc`.
19
19
- It is possible to filter and/or sort by geographical criteria of the user's choice.
20
20
-`_geo` must be set as a filterable attribute to use geo filtering capabilities.
21
21
-`_geo` must be set as a sortable attribute to use geo sort capabilities.
@@ -189,9 +189,7 @@ Following the [`sort` specification feature](https://github.com/meilisearch/spec
189
189
>
190
190
>There is no `geo` ranking rule as such. It is in fact within the `sort` ranking rule in an obfuscated way.
191
191
>
192
-
>`_geoPoint` built-in sort rule can sort documents in ascending order only.
193
-
>
194
-
> The `:desc` order is not supported due to a technical limit. See Technical Aspects part for more details.
192
+
>`_geoPoint` built-in sort rule can sort documents in ascending/descending order.
195
193
196
194
#### GET Search `/indexes/{indexUid}/search`
197
195
@@ -207,7 +205,6 @@ Following the [`sort` specification feature](https://github.com/meilisearch/spec
207
205
}
208
206
```
209
207
- 🔴 Specifying parameters that do not conform to the `_geoPoint` signature causes the API to return an `invalid_sort` error. The error message should indicate how `_geoPoint` should be used. See `_geoPoint` built-in sort rule definition part.
210
-
- 🔴 Specifying `:desc` for a `_geoPoint` sort rule will raise an `invalid_sort` error with a message explaining that `_geoPoint` can only be used with `:asc` order.
211
208
- 🔴 Using `_geo`, `_geoDistance`, `_geoRadius` in a sort expression cause the API to return an `invalid_sort` error. `message` should be `:reservedKeyword is a reserved keyword and thus can't be used as a sort expression.`
212
209
213
210
---
@@ -260,39 +257,14 @@ This error is raised asynchronously when the user tries to specify an invalid ra
260
257
261
258
## 2. Technical Aspects
262
259
263
-
### I. :desc case - Sorting documents around a geo point
264
-
265
-
We may encounter technical difficulties to implement a descending order capability for the geo sorting. This first iteration will allow us to identify if this is a real technical problem. If we verify the existence of this problem, we will think at this moment of the best solution to bring on the table.
266
-
267
-
> 💡 In a first step, we could not allow `:desc` on a geoPoint if it's a complex technical issue.
268
-
269
-
---
270
-
271
-
Edit-date: 2021-08-31
272
-
273
-
As imagined during the first phases of discovery we encounter a technical difficulty to compute a descending order around a `_geoPoint`.
274
-
275
-
The technical team will have to do some preparatory work to overcome this limitation. For the time being, it is not planned to spend more time on this as it is not a primary use case. The impact may be very small, so it's not worth the effort at this point.
276
-
277
-
### Decision taken
278
-
279
-
It was decided after a discussion with @irevoire and @Kerollmops that when the user specifies the sort rule `_geoPoint(lat, lng):desc` an error `invalid_sort` will be returned with a message explaining that `:desc` is not available.
280
-
281
-
#### Why keep the :asc if :desc is not valid?
282
-
283
-
To keep consistency and not to introduce a different syntax among the `sort` search parameter. This is something we'll re-evaluate later.
284
-
285
-
---
286
-
287
-
### II. Measuring
260
+
### I. Measuring
288
261
289
262
-`filterableAttribute` setting definition to evaluate `_geo` presence.
290
263
-`sortableAttribute` setting definition to evaluate `_geo` presence.
291
264
292
265
## 3. Future Possibilities
293
266
294
267
- Add built-in filter to filter documents within `polygon` and `bounding-box`.
295
-
- Handling `:desc` order around a geoPoint
296
268
- Handling array of geo points in the document object.
297
269
- Handling multiple geo formats for the `_geo` field. e.g. "{lat},{lng}", a geohash etc.
298
270
- Handling distance in other formats (like the imperial format). **It's easy to implement on the user side though.**
0 commit comments