Skip to content

Commit 92b5f94

Browse files
authored
breaking: fix geoJson parameter (#318)
* breaking: fix `geoJson` parameter * update `geo_json` docstring
1 parent 97bf6d8 commit 92b5f94

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

arango/collection.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -1373,7 +1373,7 @@ def add_skiplist_index(
13731373
def add_geo_index(
13741374
self,
13751375
fields: Fields,
1376-
ordered: Optional[bool] = None,
1376+
geo_json: Optional[bool] = None,
13771377
name: Optional[str] = None,
13781378
in_background: Optional[bool] = None,
13791379
legacyPolygons: Optional[bool] = False,
@@ -1385,8 +1385,10 @@ def add_geo_index(
13851385
with at least two floats. Documents with missing fields or invalid
13861386
values are excluded.
13871387
:type fields: str | [str]
1388-
:param ordered: Whether the order is longitude, then latitude.
1389-
:type ordered: bool | None
1388+
:param geo_json: Whether to use GeoJSON data-format or not. This
1389+
parameter has been renamed from `ordered`. See Github Issue
1390+
#234 for more details.
1391+
:type geo_json: bool | None
13901392
:param name: Optional name for the index.
13911393
:type name: str | None
13921394
:param in_background: Do not hold the collection lock.
@@ -1400,8 +1402,8 @@ def add_geo_index(
14001402
"""
14011403
data: Json = {"type": "geo", "fields": fields}
14021404

1403-
if ordered is not None:
1404-
data["geoJson"] = ordered
1405+
if geo_json is not None:
1406+
data["geoJson"] = geo_json
14051407
if name is not None:
14061408
data["name"] = name
14071409
if in_background is not None:

tests/test_index.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ def test_add_skiplist_index(icol):
107107
def test_add_geo_index(icol):
108108
# Test add geo index with one attribute
109109
result = icol.add_geo_index(
110-
fields=["attr1"], ordered=False, name="geo_index", in_background=True
110+
fields=["attr1"], geo_json=True, name="geo_index", in_background=True
111111
)
112112

113113
expected_index = {
114114
"sparse": True,
115115
"type": "geo",
116116
"fields": ["attr1"],
117117
"unique": False,
118-
"geo_json": False,
118+
"geo_json": True,
119119
"name": "geo_index",
120120
}
121121
for key, value in expected_index.items():
@@ -126,7 +126,7 @@ def test_add_geo_index(icol):
126126
# Test add geo index with two attributes
127127
result = icol.add_geo_index(
128128
fields=["attr1", "attr2"],
129-
ordered=False,
129+
geo_json=False,
130130
)
131131
expected_index = {
132132
"sparse": True,

0 commit comments

Comments
 (0)