Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,11 @@ geosearch_guide_filter_settings_1: |-
-X PUT 'MEILISEARCH_URL/indexes/restaurants/settings/filterable-attributes' \
-H 'Content-type:application/json' \
--data-binary '["_geo"]'
geosearch_guide_filter_settings_2: |-
curl \
-X PUT 'MEILISEARCH_URL/indexes/neighborhoods/settings/filterable-attributes' \
-H 'Content-type:application/json' \
--data-binary '["_geojson"]'
geosearch_guide_filter_usage_1: |-
curl \
-X POST 'MEILISEARCH_URL/indexes/restaurants/search' \
Expand Down
15 changes: 4 additions & 11 deletions capabilities/geo_search/how_to/use_geojson_format.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: Use GeoJSON format
description: Index complex geometries like polygons and multi-polygons using the GeoJSON standard format.
---

import CodeSamplesGeosearchGuideFilterSettings2 from '/snippets/generated-code-samples/code_samples_geosearch_guide_filter_settings_2.mdx';

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.

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

## Filtering and sorting with GeoJSON documents

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.

<CodeGroup>
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.

```bash
curl \
-X PUT 'MEILISEARCH_URL/indexes/neighborhoods/settings/filterable-attributes' \
-H 'Content-type:application/json' \
--data-binary '["_geo"]'
```

</CodeGroup>
<CodeSamplesGeosearchGuideFilterSettings2 />

Then search as usual:

Expand Down
Loading