Skip to content

Add (ArangoSearch) View support #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 30, 2018
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
64 changes: 64 additions & 0 deletions docs/Drivers/Java/Reference/Database/ViewAccess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Accessing views

These functions implement the
[HTTP API for accessing view](https://docs.arangodb.com/latest/HTTP/Views/Getting.html).

## ArangoDatabase.view

```
ArangoDatabase.view(String name) : ArangoView
```

Returns a _ArangoView_ instance for the given view name.

**Arguments**

- **name**: `String`

Name of the view

**Examples**

```Java
ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB");
ArangoView view = db.view("myView");
```

## ArangoDatabase.arangoSearch

```
ArangoDatabase.arangoSearch(String name) : ArangoSearch
```

Returns a _ArangoSearch_ instance for the given ArangoSearch view name.

**Arguments**

- **name**: `String`

Name of the view

**Examples**

```Java
ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB");
ArangoSearch view = db.arangoSearch("myArangoSearchView");
```

## ArangoDatabase.getViews

```
ArangoDatabase.getViews() : Collection<ViewEntity>
```

Fetches all views from the database and returns an list of collection descriptions.

**Examples**

```Java
ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB");
Collection<ViewEntity> infos = db.getViews();
```
4 changes: 4 additions & 0 deletions docs/Drivers/Java/Reference/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- [Database](Database/README.md)
- [Database Manipulation](Database/DatabaseManipulation.md)
- [Collection Access](Database/CollectionAccess.md)
- [View Access](Database/ViewAccess.md)
- [Queries](Database/Queries.md)
- [AQL User Functions](Database/AqlUserFunctions.md)
- [Transactions](Database/Transactions.md)
Expand All @@ -14,6 +15,9 @@
- [Document Manipulation](Collection/DocumentManipulation.md)
- [Indexes](Collection/Indexes.md)
- [Bulk Import](Collection/BulkImport.md)
- [View](View/README.md)
- [View Manipulation](View/ViewManipulation.md)
- [ArangoSearch Views](View/ArangoSearch.md)
- [Cursor](Cursor.md)
- [Graph](Graph/README.md)
- [Vertex Collection](Graph/VertexCollection.md)
Expand Down
188 changes: 188 additions & 0 deletions docs/Drivers/Java/Reference/View/ArangoSearch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
# ArangoSearch API

These functions implement the
[HTTP API for ArangoSearch views](https://docs.arangodb.com/latest/HTTP/Views/ArangoSearch.html).

## ArangoDatabase.createArangoSearch

```
ArangoDatabase.createArangoSearch(String name, ArangoSearchCreateOptions options) : ViewEntity
```

Creates a ArangoSearch view with the given _options_, then returns view information from the server.

**Arguments**

- **name**: `String`

The name of the view

- **options**: `ArangoSearchCreateOptions`

- **locale**: `String`

The default locale used for queries on analyzed string values (default: C).

- **commitIntervalMsec**: `Long`

Wait at least this many milliseconds between committing index data changes and making them visible to queries (default: 60000, to disable use: 0). For the case where there are a lot of inserts/updates, a lower value, until commit, will cause the index not to account for them and memory usage would continue to grow. For the case where there are a few inserts/updates, a higher value will impact performance and waste disk space for each commit call without any added benefits.

- **cleanupIntervalStep**: `Long`

Wait at least this many commits between removing unused files in data directory (default: 10, to disable use: 0). For the case where the consolidation policies merge segments often (i.e. a lot of commit+consolidate), a lower value will cause a lot of disk space to be wasted. For the case where the consolidation policies rarely merge segments (i.e. few inserts/deletes), a higher value will impact performance without any added benefits.

- **threshold**: `ConsolidateThreshold[]`

A list of consolidate thresholds

**Examples**

```Java
ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB");
db.createArangoSearch("potatos", new ArangoSearchPropertiesOptions());
// the ArangoSearch view "potatos" now exists
```

## ArangoSearch.create

```
ArangoSearch.create(ArangoSearchCreateOptions options) : ViewEntity
```

Creates a ArangoSearch view with the given _options_, then returns view information from the server.

Alternative for [ArangoDatabase.createArangoSearch](#arangodatabasecreatearangosearch).

**Arguments**

- **options**: `ArangoSearchCreateOptions`

- **locale**: `String`

The default locale used for queries on analyzed string values (default: C).

- **commitIntervalMsec**: `Long`

Wait at least this many milliseconds between committing index data changes and making them visible to queries (default: 60000, to disable use: 0). For the case where there are a lot of inserts/updates, a lower value, until commit, will cause the index not to account for them and memory usage would continue to grow. For the case where there are a few inserts/updates, a higher value will impact performance and waste disk space for each commit call without any added benefits.

- **cleanupIntervalStep**: `Long`

Wait at least this many commits between removing unused files in data directory (default: 10, to disable use: 0). For the case where the consolidation policies merge segments often (i.e. a lot of commit+consolidate), a lower value will cause a lot of disk space to be wasted. For the case where the consolidation policies rarely merge segments (i.e. few inserts/deletes), a higher value will impact performance without any added benefits.

- **threshold**: `ConsolidateThreshold[]`

A list of consolidate thresholds

**Examples**

```Java
ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB");
ArangoSearch view = db.arangoSearch("potatos");

view.create(new ArangoSearchPropertiesOptions());
// the ArangoSearch view "potatos" now exists
```

## ArangoSearch.getProperties

```
ArangoSearch.getProperties() : ArangoSearchPropertiesEntity
```

Reads the properties of the specified view.

**Examples**

```Java
ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB");
ArangoSearch view = db.arangoSearch("potatos");

ArangoSearchPropertiesEntity properties = view.getProperties();
```

## ArangoSearch.updateProperties

```
ArangoSearch.updateProperties(ArangoSearchPropertiesOptions options) : ArangoSearchPropertiesEntity
```

Partially changes properties of the view.

**Arguments**

- **options**: `ArangoSearchPropertiesOptions`

- **locale**: `String`

The default locale used for queries on analyzed string values (default: C).

- **commitIntervalMsec**: `Long`

Wait at least this many milliseconds between committing index data changes and making them visible to queries (default: 60000, to disable use: 0). For the case where there are a lot of inserts/updates, a lower value, until commit, will cause the index not to account for them and memory usage would continue to grow. For the case where there are a few inserts/updates, a higher value will impact performance and waste disk space for each commit call without any added benefits.

- **cleanupIntervalStep**: `Long`

Wait at least this many commits between removing unused files in data directory (default: 10, to disable use: 0). For the case where the consolidation policies merge segments often (i.e. a lot of commit+consolidate), a lower value will cause a lot of disk space to be wasted. For the case where the consolidation policies rarely merge segments (i.e. few inserts/deletes), a higher value will impact performance without any added benefits.

- **threshold**: `ConsolidateThreshold[]`

A list of consolidate thresholds

- **link**: `CollectionLink[]`

A list of linked collections

**Examples**

```Java
ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB");
ArangoSearch view = db.arangoSearch("some-view");

view.updateProperties(new ArangoSearchPropertiesOptions().link(CollectionLink.on("myCollection").fields(FieldLink.on("value").analyzers("identity"))));
```

## ArangoSearch.replaceProperties

```
ArangoSearch.replaceProperties(ArangoSearchPropertiesOptions options) : ArangoSearchPropertiesEntity
```

Changes properties of the view.

**Arguments**

- **options**: `ArangoSearchPropertiesOptions`

- **locale**: `String`

The default locale used for queries on analyzed string values (default: C).

- **commitIntervalMsec**: `Long`

Wait at least this many milliseconds between committing index data changes and making them visible to queries (default: 60000, to disable use: 0). For the case where there are a lot of inserts/updates, a lower value, until commit, will cause the index not to account for them and memory usage would continue to grow. For the case where there are a few inserts/updates, a higher value will impact performance and waste disk space for each commit call without any added benefits.

- **cleanupIntervalStep**: `Long`

Wait at least this many commits between removing unused files in data directory (default: 10, to disable use: 0). For the case where the consolidation policies merge segments often (i.e. a lot of commit+consolidate), a lower value will cause a lot of disk space to be wasted. For the case where the consolidation policies rarely merge segments (i.e. few inserts/deletes), a higher value will impact performance without any added benefits.

- **threshold**: `ConsolidateThreshold[]`

A list of consolidate thresholds

- **link**: `CollectionLink[]`

A list of linked collections

**Examples**

```Java
ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB");
ArangoSearch view = db.arangoSearch("some-view");

view.replaceProperties(new ArangoSearchPropertiesOptions().link(CollectionLink.on("myCollection").fields(FieldLink.on("value").analyzers("identity"))));
```
46 changes: 46 additions & 0 deletions docs/Drivers/Java/Reference/View/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# View API

These functions implement the
[HTTP API for views](https://docs.arangodb.com/latest/HTTP/Views/index.html).

## Getting information about the view

See
[the HTTP API documentation](https://docs.arangodb.com/latest/HTTP/Views/Getting.html)
for details.

## ArangoView.exists

```
ArangoView.exists() : boolean
```

Checks whether the view exists

**Examples**

```Java
ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB");
ArangoView view = db.view("potatos");

boolean exists = view.exists();
```

## ArangoView.getInfo

```
ArangoView.getInfo() : ViewEntity
```

Returns information about the view.

**Examples**

```Java
ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB");
ArangoView view = db.view("potatos");

ViewEntity info = view.getInfo();
```
76 changes: 76 additions & 0 deletions docs/Drivers/Java/Reference/View/ViewManipulation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Manipulating the view

These functions implement
[the HTTP API for modifying views](https://docs.arangodb.com/latest/HTTP/Views/Modifying.html).

## ArangoDatabase.createView

```
ArangoDatabase.createView(String name, ViewType type) : ViewEntity
```

Creates a view of the given _type_, then returns view information from the server.

**Arguments**

- **name**: `String`

The name of the view

- **type**: `ViewType`

The type of the view

**Examples**

```Java
ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB");
db.createView("myView", ViewType.ARANGO_SEARCH);
// the view "potatos" now exists
```

## ArangoView.rename

```
ArangoView.rename(String newName) : ViewEntity
```

Renames the view.

**Arguments**

- **newName**: `String`

The new name

**Examples**

```Java
ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB");
ArangoView view = db.view("some-view");

ViewEntity result = view.rename("new-view-name")
assertThat(result.getName(), is("new-view-name");
// result contains additional information about the view
```

## ArangoView.drop

```
ArangoView.drop() : void
```

Deletes the view from the database.

**Examples**

```Java
ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB");
ArangoView view = db.view("some-view");

view.drop();
// the view "some-view" no longer exists
```
Loading