Skip to content

Commit e535d7f

Browse files
Merge pull request #1060 from redis/DOC-4732-geo-index-tces
DOC-4732 added TCE markup to geo index page
2 parents b5c5844 + 4126b25 commit e535d7f

File tree

1 file changed

+12
-12
lines changed
  • content/develop/interact/search-and-query/indexing

1 file changed

+12
-12
lines changed

content/develop/interact/search-and-query/indexing/geoindex.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,32 +35,32 @@ reference page for a full description of both types.
3535
The following command creates a `GEO` index for JSON objects that contain
3636
the geospatial data in a field called `location`:
3737

38-
```bash
38+
{{< clients-example geoindex create_geo_idx >}}
3939
> FT.CREATE productidx ON JSON PREFIX 1 product: SCHEMA $.location AS location GEO
4040
OK
41-
```
41+
{{< /clients-example >}}
4242

4343
If you now add JSON objects with the `product:` prefix and a `location` field,
4444
they will be added to the index automatically:
4545

46-
```bash
46+
{{< clients-example geoindex add_geo_json >}}
4747
> JSON.SET product:46885 $ '{"description": "Navy Blue Slippers","price": 45.99,"city": "Denver","location": "-104.991531, 39.742043"}'
4848
OK
4949
> JSON.SET product:46886 $ '{"description": "Bright Green Socks","price": 25.50,"city": "Fort Collins","location": "-105.0618814,40.5150098"}'
5050
OK
51-
```
51+
{{< /clients-example >}}
5252

5353
The query below finds products within a 100 mile radius of Colorado Springs
5454
(Longitude=-104.800644, Latitude=38.846127). This returns only the location in
5555
Denver, but a radius of 200 miles would also include the location in Fort Collins:
5656

57-
```bash
57+
{{< clients-example geoindex geo_query >}}
5858
> FT.SEARCH productidx '@location:[-104.800644 38.846127 100 mi]'
5959
1) "1"
6060
2) "product:46885"
6161
3) 1) "$"
6262
2) "{\"description\":\"Navy Blue Slippers\",\"price\":45.99,\"city\":\"Denver\",\"location\":\"-104.991531, 39.742043\"}"
63-
```
63+
{{< /clients-example >}}
6464

6565
See [Geospatial queries]({{< relref "/develop/interact/search-and-query/query/geo-spatial" >}})
6666
for more information about the available options.
@@ -73,14 +73,14 @@ of the field definition specifies Cartesian coordinates instead of
7373
the default spherical geographical coordinates. Use `SPHERICAL` in
7474
place of `FLAT` to choose the coordinate space explicitly.
7575

76-
```bash
76+
{{< clients-example geoindex create_gshape_idx >}}
7777
> FT.CREATE geomidx ON JSON PREFIX 1 shape: SCHEMA $.name AS name TEXT $.geom AS geom GEOSHAPE FLAT
7878
OK
79-
```
79+
{{< /clients-example >}}
8080

8181
Use the `shape:` prefix for the JSON objects to add them to the index:
8282

83-
```bash
83+
{{< clients-example geoindex add_gshape_json >}}
8484
> JSON.SET shape:1 $ '{"name": "Green Square", "geom": "POLYGON ((1 1, 1 3, 3 3, 3 1, 1 1))"}'
8585
OK
8686
> JSON.SET shape:2 $ '{"name": "Red Rectangle", "geom": "POLYGON ((2 2.5, 2 3.5, 3.5 3.5, 3.5 2.5, 2 2.5))"}'
@@ -89,20 +89,20 @@ OK
8989
OK
9090
> JSON.SET shape:4 $ '{"name": "Purple Point", "geom": "POINT (2 2)"}'
9191
OK
92-
```
92+
{{< /clients-example >}}
9393

9494
You can now run various geospatial queries against the index. For
9595
example, the query below returns any shapes within the boundary
9696
of the green square but omits the green square itself:
9797

98-
```bash
98+
{{< clients-example geoindex gshape_query >}}
9999
> FT.SEARCH geomidx "(-@name:(Green Square) @geom:[WITHIN $qshape])" PARAMS 2 qshape "POLYGON ((1 1, 1 3, 3 3, 3 1, 1 1))" RETURN 1 name DIALECT 4
100100
101101
1) (integer) 1
102102
2) "shape:4"
103103
3) 1) "name"
104104
2) "[\"Purple Point\"]"
105-
```
105+
{{< /clients-example >}}
106106

107107
You can also run queries to find whether shapes in the index completely contain
108108
or overlap each other. See

0 commit comments

Comments
 (0)