Skip to content

Commit

Permalink
InvertedIndexOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
rashtao committed Sep 13, 2022
1 parent b1a7af3 commit 63b2223
Show file tree
Hide file tree
Showing 7 changed files with 485 additions and 10 deletions.
10 changes: 10 additions & 0 deletions src/main/java/com/arangodb/ArangoCollection.java
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,16 @@ <T> MultiDocumentEntity<DocumentDeleteEntity<T>> deleteDocuments(
*/
IndexEntity ensurePersistentIndex(Iterable<String> fields, PersistentIndexOptions options) throws ArangoDBException;

/**
* Creates an inverted index for the collection, if it does not already exist.
*
* @param options index creation options
* @return information about the index
* @throws ArangoDBException
* @see <a href="https://www.arangodb.com/docs/stable/http/indexes-inverted.html">API Documentation</a>
*/
Object ensureInvertedIndex(InvertedIndexOptions options) throws ArangoDBException;

/**
* Creates a geo-spatial index for the collection, if it does not already exist.
*
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/com/arangodb/entity/IndexType.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,10 @@ public enum IndexType {

ttl,

zkd
zkd,

/**
* @since ArangoDB 3.10
*/
inverted
}
5 changes: 5 additions & 0 deletions src/main/java/com/arangodb/internal/ArangoCollectionImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,11 @@ public IndexEntity ensurePersistentIndex(final Iterable<String> fields, final Pe
return executor.execute(createPersistentIndexRequest(fields, options), IndexEntity.class);
}

@Override
public Object ensureInvertedIndex(final InvertedIndexOptions options) throws ArangoDBException {
return executor.execute(createInvertedIndexRequest(options), Object.class);
}

@Override
public IndexEntity ensureGeoIndex(final Iterable<String> fields, final GeoIndexOptions options)
throws ArangoDBException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,13 @@ protected Request createPersistentIndexRequest(
return request;
}

protected Request createInvertedIndexRequest(final InvertedIndexOptions options) {
final Request request = request(db.dbName(), RequestType.POST, PATH_API_INDEX);
request.putQueryParam(COLLECTION, name);
request.setBody(util().serialize(options));
return request;
}

protected Request createGeoIndexRequest(final Iterable<String> fields, final GeoIndexOptions options) {
final Request request = request(db.dbName(), RequestType.POST, PATH_API_INDEX);
request.putQueryParam(COLLECTION, name);
Expand Down
Loading

0 comments on commit 63b2223

Please sign in to comment.