diff --git a/arango/collection.py b/arango/collection.py index d483a5b4..c6ea4184 100644 --- a/arango/collection.py +++ b/arango/collection.py @@ -1373,7 +1373,7 @@ def add_skiplist_index( def add_geo_index( self, fields: Fields, - ordered: Optional[bool] = None, + geo_json: Optional[bool] = None, name: Optional[str] = None, in_background: Optional[bool] = None, legacyPolygons: Optional[bool] = False, @@ -1385,8 +1385,10 @@ def add_geo_index( with at least two floats. Documents with missing fields or invalid values are excluded. :type fields: str | [str] - :param ordered: Whether the order is longitude, then latitude. - :type ordered: bool | None + :param geo_json: Whether to use GeoJSON data-format or not. This + parameter has been renamed from `ordered`. See Github Issue + #234 for more details. + :type geo_json: bool | None :param name: Optional name for the index. :type name: str | None :param in_background: Do not hold the collection lock. @@ -1400,8 +1402,8 @@ def add_geo_index( """ data: Json = {"type": "geo", "fields": fields} - if ordered is not None: - data["geoJson"] = ordered + if geo_json is not None: + data["geoJson"] = geo_json if name is not None: data["name"] = name if in_background is not None: diff --git a/tests/test_index.py b/tests/test_index.py index 840d744a..375ff000 100644 --- a/tests/test_index.py +++ b/tests/test_index.py @@ -107,7 +107,7 @@ def test_add_skiplist_index(icol): def test_add_geo_index(icol): # Test add geo index with one attribute result = icol.add_geo_index( - fields=["attr1"], ordered=False, name="geo_index", in_background=True + fields=["attr1"], geo_json=True, name="geo_index", in_background=True ) expected_index = { @@ -115,7 +115,7 @@ def test_add_geo_index(icol): "type": "geo", "fields": ["attr1"], "unique": False, - "geo_json": False, + "geo_json": True, "name": "geo_index", } for key, value in expected_index.items(): @@ -126,7 +126,7 @@ def test_add_geo_index(icol): # Test add geo index with two attributes result = icol.add_geo_index( fields=["attr1", "attr2"], - ordered=False, + geo_json=False, ) expected_index = { "sparse": True,