Skip to content

Commit 63b2223

Browse files
committed
InvertedIndexOptions
1 parent b1a7af3 commit 63b2223

File tree

7 files changed

+485
-10
lines changed

7 files changed

+485
-10
lines changed

src/main/java/com/arangodb/ArangoCollection.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,16 @@ <T> MultiDocumentEntity<DocumentDeleteEntity<T>> deleteDocuments(
498498
*/
499499
IndexEntity ensurePersistentIndex(Iterable<String> fields, PersistentIndexOptions options) throws ArangoDBException;
500500

501+
/**
502+
* Creates an inverted index for the collection, if it does not already exist.
503+
*
504+
* @param options index creation options
505+
* @return information about the index
506+
* @throws ArangoDBException
507+
* @see <a href="https://www.arangodb.com/docs/stable/http/indexes-inverted.html">API Documentation</a>
508+
*/
509+
Object ensureInvertedIndex(InvertedIndexOptions options) throws ArangoDBException;
510+
501511
/**
502512
* Creates a geo-spatial index for the collection, if it does not already exist.
503513
*

src/main/java/com/arangodb/entity/IndexType.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,10 @@ public enum IndexType {
5050

5151
ttl,
5252

53-
zkd
53+
zkd,
54+
55+
/**
56+
* @since ArangoDB 3.10
57+
*/
58+
inverted
5459
}

src/main/java/com/arangodb/internal/ArangoCollectionImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,11 @@ public IndexEntity ensurePersistentIndex(final Iterable<String> fields, final Pe
279279
return executor.execute(createPersistentIndexRequest(fields, options), IndexEntity.class);
280280
}
281281

282+
@Override
283+
public Object ensureInvertedIndex(final InvertedIndexOptions options) throws ArangoDBException {
284+
return executor.execute(createInvertedIndexRequest(options), Object.class);
285+
}
286+
282287
@Override
283288
public IndexEntity ensureGeoIndex(final Iterable<String> fields, final GeoIndexOptions options)
284289
throws ArangoDBException {

src/main/java/com/arangodb/internal/InternalArangoCollection.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,13 @@ protected Request createPersistentIndexRequest(
576576
return request;
577577
}
578578

579+
protected Request createInvertedIndexRequest(final InvertedIndexOptions options) {
580+
final Request request = request(db.dbName(), RequestType.POST, PATH_API_INDEX);
581+
request.putQueryParam(COLLECTION, name);
582+
request.setBody(util().serialize(options));
583+
return request;
584+
}
585+
579586
protected Request createGeoIndexRequest(final Iterable<String> fields, final GeoIndexOptions options) {
580587
final Request request = request(db.dbName(), RequestType.POST, PATH_API_INDEX);
581588
request.putQueryParam(COLLECTION, name);

0 commit comments

Comments
 (0)