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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ db = client.db("test", username="root", password="passwd")
# Create a new collection named "students".
students = db.create_collection("students")

# Add a hash index to the collection.
students.add_hash_index(fields=["name"], unique=True)
# Add a persistent index to the collection.
students.add_persistent_index(fields=["name"], unique=True)

# Insert new documents into the collection.
students.insert({"name": "jane", "age": 39})
Expand Down
14 changes: 14 additions & 0 deletions arango/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1293,6 +1293,13 @@ def add_hash_index(
) -> Result[Json]:
"""Create a new hash index.

.. warning::

The index types `hash` and `skiplist` are aliases for the persistent
index type and should no longer be used to create new indexes. The
aliases will be removed in a future version. Use
:func:`arango.collection.Collection.add_persistent_index` instead.

:param fields: Document fields to index.
:type fields: [str]
:param unique: Whether the index is unique.
Expand Down Expand Up @@ -1337,6 +1344,13 @@ def add_skiplist_index(
) -> Result[Json]:
"""Create a new skiplist index.

.. warning::

The index types `hash` and `skiplist` are aliases for the persistent
index type and should no longer be used to create new indexes. The
aliases will be removed in a future version. Use
:func:`arango.collection.Collection.add_persistent_index` instead.

:param fields: Document fields to index.
:type fields: [str]
:param unique: Whether the index is unique.
Expand Down
4 changes: 4 additions & 0 deletions arango/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ def format_index(body: Json) -> Json:
if "fieldValueTypes" in body:
result["field_value_types"] = body["fieldValueTypes"]

# Introduced in 3.12 EE
if "optimizeTopK" in body:
result["optimizeTopK"] = body["optimizeTopK"]

return verify_format(body, result)


Expand Down
10 changes: 5 additions & 5 deletions docs/indexes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ on fields ``_from`` and ``_to``. For more information on indexes, refer to
# List the indexes in the collection.
cities.indexes()

# Add a new hash index on document fields "continent" and "country".
index = cities.add_hash_index(fields=['continent', 'country'], unique=True)
# Add a new persistent index on document fields "continent" and "country".
index = cities.add_persistent_index(fields=['continent', 'country'], unique=True)

# Add new fulltext indexes on fields "continent" and "country".
index = cities.add_fulltext_index(fields=['continent'])
index = cities.add_fulltext_index(fields=['country'])

# Add a new skiplist index on field 'population'.
index = cities.add_skiplist_index(fields=['population'], sparse=False)
# Add a new persistent index on field 'population'.
index = cities.add_persistent_index(fields=['population'], sparse=False)

# Add a new geo-spatial index on field 'coordinates'.
index = cities.add_geo_index(fields=['coordinates'])
Expand All @@ -47,7 +47,7 @@ on fields ``_from`` and ``_to``. For more information on indexes, refer to
index = cities.add_ttl_index(fields=['currency'], expiry_time=200)

# Indexes may be added with a name that can be referred to in AQL queries.
index = cities.add_hash_index(fields=['country'], name='my_hash_index')
index = cities.add_persistent_index(fields=['country'], name='my_persistent_index')

# Delete the last index from the collection.
cities.delete_index(index['id'])
Expand Down
2 changes: 1 addition & 1 deletion tests/static/single-3.12.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jwt-secret = /tests/static/keyfile
all.database.password = passwd
all.database.extended-names = true
all.javascript.allow-admin-execute = true
all.server.options-api = admin
all.server.options-api = admin