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
26 changes: 25 additions & 1 deletion arango/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,7 @@ def add_geo_index(
ordered: Optional[bool] = None,
name: Optional[str] = None,
in_background: Optional[bool] = None,
legacyPolygons: Optional[bool] = False,
) -> Result[Json]:
"""Create a new geo-spatial index.

Expand All @@ -1151,6 +1152,9 @@ def add_geo_index(
:type name: str | None
:param in_background: Do not hold the collection lock.
:type in_background: bool | None
:param legacyPolygons: Whether or not to use use the old, pre-3.10 rules
for the parsing GeoJSON polygons
:type legacyPolygons: bool | None
:return: New index details.
:rtype: dict
:raise arango.exceptions.IndexCreateError: If create fails.
Expand All @@ -1163,6 +1167,8 @@ def add_geo_index(
data["name"] = name
if in_background is not None:
data["inBackground"] = in_background
if legacyPolygons is not None:
data["legacyPolygons"] = legacyPolygons

return self._add_index(data)

Expand All @@ -1173,7 +1179,9 @@ def add_fulltext_index(
name: Optional[str] = None,
in_background: Optional[bool] = None,
) -> Result[Json]:
"""Create a new fulltext index.
"""Create a new fulltext index. This method is deprecated
in ArangoDB 3.10 and will be removed in a future version
of the driver.

:param fields: Document fields to index.
:type fields: [str]
Expand Down Expand Up @@ -1205,6 +1213,8 @@ def add_persistent_index(
sparse: Optional[bool] = None,
name: Optional[str] = None,
in_background: Optional[bool] = None,
storedValues: Sequence[str] = [],
cacheEnabled: Optional[bool] = None,
) -> Result[Json]:
"""Create a new persistent index.

Expand All @@ -1223,6 +1233,16 @@ def add_persistent_index(
:type name: str | None
:param in_background: Do not hold the collection lock.
:type in_background: bool | None
:param storedValues: Additional attributes to include in a persistent
index. These additional attributes cannot be used for index
lookups or sorts, but they can be used for projections. Must be
an array of index attribute paths. There must be no overlap of
attribute paths between fields and storedValues. The maximum
number of values is 32.
:type storedValues: [str]
:param cacheEnabled: Enable an in-memory cache for index values for
persistent indexes.
:type cacheEnabled: bool | None
:return: New index details.
:rtype: dict
:raise arango.exceptions.IndexCreateError: If create fails.
Expand All @@ -1237,6 +1257,10 @@ def add_persistent_index(
data["name"] = name
if in_background is not None:
data["inBackground"] = in_background
if storedValues is not None:
data["storedValues"] = storedValues
if cacheEnabled is not None:
data["cacheEnabled"] = cacheEnabled

return self._add_index(data)

Expand Down
6 changes: 6 additions & 0 deletions arango/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ def format_index(body: Json) -> Json:
result["worst_indexed_level"] = body["worstIndexedLevel"]
if "maxNumCoverCells" in body:
result["max_num_cover_cells"] = body["maxNumCoverCells"]
if "storedValues" in body:
result["storedValues"] = body["storedValues"]
if "cacheEnabled" in body:
result["cacheEnabled"] = body["cacheEnabled"]
if "legacyPolygons" in body:
result["legacyPolygons"] = body["legacyPolygons"]

return verify_format(body, result)

Expand Down