Skip to content

Commit e2119c5

Browse files
authored
Merge pull request #3586 from meilisearch/fix-geojson
Fix geojson
2 parents 785cf54 + b06f356 commit e2119c5

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

.code-samples.meilisearch.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,11 @@ geosearch_guide_filter_settings_1: |-
10121012
-X PUT 'MEILISEARCH_URL/indexes/restaurants/settings/filterable-attributes' \
10131013
-H 'Content-type:application/json' \
10141014
--data-binary '["_geo"]'
1015+
geosearch_guide_filter_settings_2: |-
1016+
curl \
1017+
-X PUT 'MEILISEARCH_URL/indexes/neighborhoods/settings/filterable-attributes' \
1018+
-H 'Content-type:application/json' \
1019+
--data-binary '["_geojson"]'
10151020
geosearch_guide_filter_usage_1: |-
10161021
curl \
10171022
-X POST 'MEILISEARCH_URL/indexes/restaurants/search' \

capabilities/geo_search/how_to/use_geojson_format.mdx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Use GeoJSON format
33
description: Index complex geometries like polygons and multi-polygons using the GeoJSON standard format.
44
---
55

6+
import CodeSamplesGeosearchGuideFilterSettings2 from '/snippets/generated-code-samples/code_samples_geosearch_guide_filter_settings_2.mdx';
7+
68
GeoJSON is a standardized format for encoding geographic data structures. Meilisearch supports GeoJSON through the `_geojson` field, allowing you to index complex shapes like polygons and multi-polygons in addition to simple point coordinates.
79

810
Use GeoJSON when your documents represent areas (neighborhoods, properties, delivery zones) rather than single points.
@@ -113,18 +115,9 @@ Use a MultiPolygon when a single document covers multiple separate areas:
113115

114116
## Filtering and sorting with GeoJSON documents
115117

116-
Filtering works the same way with GeoJSON documents as with `_geo` documents. Add `_geo` to [`filterableAttributes`](/capabilities/filtering_sorting_faceting/getting_started), then use `_geoRadius`, `_geoBoundingBox`, or `_geoPolygon` in your search queries.
117-
118-
<CodeGroup>
118+
Filtering works the same way with GeoJSON documents as with `_geo` documents. Add `_geojson` to [`filterableAttributes`](/capabilities/filtering_sorting_faceting/getting_started), then use `_geoRadius`, `_geoBoundingBox`, or `_geoPolygon` in your search queries.
119119

120-
```bash
121-
curl \
122-
-X PUT 'MEILISEARCH_URL/indexes/neighborhoods/settings/filterable-attributes' \
123-
-H 'Content-type:application/json' \
124-
--data-binary '["_geo"]'
125-
```
126-
127-
</CodeGroup>
120+
<CodeSamplesGeosearchGuideFilterSettings2 />
128121

129122
Then search as usual:
130123

0 commit comments

Comments
 (0)