Skip to content

Commit c4521fb

Browse files
author
mpv1989
committed
Add View support, add ArangoSearch support
1 parent 1067624 commit c4521fb

33 files changed

+2469
-119
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Accessing views
2+
3+
These functions implement the
4+
[HTTP API for accessing view](https://docs.arangodb.com/latest/HTTP/Views/Getting.html).
5+
6+
## ArangoDatabase.view
7+
8+
```
9+
ArangoDatabase.view(String name) : ArangoView
10+
```
11+
12+
Returns a _ArangoView_ instance for the given view name.
13+
14+
**Arguments**
15+
16+
- **name**: `String`
17+
18+
Name of the view
19+
20+
**Examples**
21+
22+
```Java
23+
ArangoDB arango = new ArangoDB.Builder().build();
24+
ArangoDatabase db = arango.db("myDB");
25+
ArangoView view = db.view("myView");
26+
```
27+
28+
## ArangoDatabase.arangoSearch
29+
30+
```
31+
ArangoDatabase.arangoSearch(String name) : ArangoSearch
32+
```
33+
34+
Returns a _ArangoSearch_ instance for the given ArangoSearch view name.
35+
36+
**Arguments**
37+
38+
- **name**: `String`
39+
40+
Name of the view
41+
42+
**Examples**
43+
44+
```Java
45+
ArangoDB arango = new ArangoDB.Builder().build();
46+
ArangoDatabase db = arango.db("myDB");
47+
ArangoSearch view = db.arangoSearch("myArangoSearchView");
48+
```
49+
50+
## ArangoDatabase.getViews
51+
52+
```
53+
ArangoDatabase.getViews() : Collection<ViewEntity>
54+
```
55+
56+
Fetches all views from the database and returns an list of collection descriptions.
57+
58+
**Examples**
59+
60+
```Java
61+
ArangoDB arango = new ArangoDB.Builder().build();
62+
ArangoDatabase db = arango.db("myDB");
63+
Collection<ViewEntity> infos = db.getViews();
64+
```

docs/Drivers/Java/Reference/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- [Database](Database/README.md)
55
- [Database Manipulation](Database/DatabaseManipulation.md)
66
- [Collection Access](Database/CollectionAccess.md)
7+
- [View Access](Database/ViewAccess.md)
78
- [Queries](Database/Queries.md)
89
- [AQL User Functions](Database/AqlUserFunctions.md)
910
- [Transactions](Database/Transactions.md)
@@ -14,6 +15,9 @@
1415
- [Document Manipulation](Collection/DocumentManipulation.md)
1516
- [Indexes](Collection/Indexes.md)
1617
- [Bulk Import](Collection/BulkImport.md)
18+
- [View](View/README.md)
19+
- [View Manipulation](View/ViewManipulation.md)
20+
- [ArangoSearch Views](View/ArangoSearch.md)
1721
- [Cursor](Cursor.md)
1822
- [Graph](Graph/README.md)
1923
- [Vertex Collection](Graph/VertexCollection.md)
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
# ArangoSearch API
2+
3+
These functions implement the
4+
[HTTP API for ArangoSearch views](https://docs.arangodb.com/latest/HTTP/Views/ArangoSearch.html).
5+
6+
## ArangoDatabase.createArangoSearch
7+
8+
```
9+
ArangoDatabase.createArangoSearch(String name, ArangoSearchCreateOptions options) : ViewEntity
10+
```
11+
12+
Creates a ArangoSearch view with the given _options_, then returns view information from the server.
13+
14+
**Arguments**
15+
16+
- **name**: `String`
17+
18+
The name of the view
19+
20+
- **options**: `ArangoSearchCreateOptions`
21+
22+
- **locale**: `String`
23+
24+
The default locale used for queries on analyzed string values (default: C).
25+
26+
- **commitIntervalMsec**: `Long`
27+
28+
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.
29+
30+
- **cleanupIntervalStep**: `Long`
31+
32+
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.
33+
34+
- **threshold**: `ConsolidateThreshold[]`
35+
36+
A list of consolidate thresholds
37+
38+
**Examples**
39+
40+
```Java
41+
ArangoDB arango = new ArangoDB.Builder().build();
42+
ArangoDatabase db = arango.db("myDB");
43+
db.createArangoSearch("potatos", new ArangoSearchPropertiesOptions());
44+
// the ArangoSearch view "potatos" now exists
45+
```
46+
47+
## ArangoSearch.create
48+
49+
```
50+
ArangoSearch.create(ArangoSearchCreateOptions options) : ViewEntity
51+
```
52+
53+
Creates a ArangoSearch view with the given _options_, then returns view information from the server.
54+
55+
Alternative for [ArangoDatabase.createArangoSearch](#arangodatabasecreatearangosearch).
56+
57+
**Arguments**
58+
59+
- **options**: `ArangoSearchCreateOptions`
60+
61+
- **locale**: `String`
62+
63+
The default locale used for queries on analyzed string values (default: C).
64+
65+
- **commitIntervalMsec**: `Long`
66+
67+
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.
68+
69+
- **cleanupIntervalStep**: `Long`
70+
71+
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.
72+
73+
- **threshold**: `ConsolidateThreshold[]`
74+
75+
A list of consolidate thresholds
76+
77+
**Examples**
78+
79+
```Java
80+
ArangoDB arango = new ArangoDB.Builder().build();
81+
ArangoDatabase db = arango.db("myDB");
82+
ArangoSearch view = db.arangoSearch("potatos");
83+
84+
view.create(new ArangoSearchPropertiesOptions());
85+
// the ArangoSearch view "potatos" now exists
86+
```
87+
88+
## ArangoSearch.getProperties
89+
90+
```
91+
ArangoSearch.getProperties() : ArangoSearchPropertiesEntity
92+
```
93+
94+
Reads the properties of the specified view.
95+
96+
**Examples**
97+
98+
```Java
99+
ArangoDB arango = new ArangoDB.Builder().build();
100+
ArangoDatabase db = arango.db("myDB");
101+
ArangoSearch view = db.arangoSearch("potatos");
102+
103+
ArangoSearchPropertiesEntity properties = view.getProperties();
104+
```
105+
106+
## ArangoSearch.updateProperties
107+
108+
```
109+
ArangoSearch.updateProperties(ArangoSearchPropertiesOptions options) : ArangoSearchPropertiesEntity
110+
```
111+
112+
Partially changes properties of the view.
113+
114+
**Arguments**
115+
116+
- **options**: `ArangoSearchPropertiesOptions`
117+
118+
- **locale**: `String`
119+
120+
The default locale used for queries on analyzed string values (default: C).
121+
122+
- **commitIntervalMsec**: `Long`
123+
124+
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.
125+
126+
- **cleanupIntervalStep**: `Long`
127+
128+
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.
129+
130+
- **threshold**: `ConsolidateThreshold[]`
131+
132+
A list of consolidate thresholds
133+
134+
- **link**: `CollectionLink[]`
135+
136+
A list of linked collections
137+
138+
**Examples**
139+
140+
```Java
141+
ArangoDB arango = new ArangoDB.Builder().build();
142+
ArangoDatabase db = arango.db("myDB");
143+
ArangoSearch view = db.arangoSearch("some-view");
144+
145+
view.updateProperties(new ArangoSearchPropertiesOptions().link(CollectionLink.on("myCollection").fields(FieldLink.on("value").analyzers("identity"))));
146+
```
147+
148+
## ArangoSearch.replaceProperties
149+
150+
```
151+
ArangoSearch.replaceProperties(ArangoSearchPropertiesOptions options) : ArangoSearchPropertiesEntity
152+
```
153+
154+
Changes properties of the view.
155+
156+
**Arguments**
157+
158+
- **options**: `ArangoSearchPropertiesOptions`
159+
160+
- **locale**: `String`
161+
162+
The default locale used for queries on analyzed string values (default: C).
163+
164+
- **commitIntervalMsec**: `Long`
165+
166+
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.
167+
168+
- **cleanupIntervalStep**: `Long`
169+
170+
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.
171+
172+
- **threshold**: `ConsolidateThreshold[]`
173+
174+
A list of consolidate thresholds
175+
176+
- **link**: `CollectionLink[]`
177+
178+
A list of linked collections
179+
180+
**Examples**
181+
182+
```Java
183+
ArangoDB arango = new ArangoDB.Builder().build();
184+
ArangoDatabase db = arango.db("myDB");
185+
ArangoSearch view = db.arangoSearch("some-view");
186+
187+
view.replaceProperties(new ArangoSearchPropertiesOptions().link(CollectionLink.on("myCollection").fields(FieldLink.on("value").analyzers("identity"))));
188+
```
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# View API
2+
3+
These functions implement the
4+
[HTTP API for views](https://docs.arangodb.com/latest/HTTP/Views/index.html).
5+
6+
## Getting information about the view
7+
8+
See
9+
[the HTTP API documentation](https://docs.arangodb.com/latest/HTTP/Views/Getting.html)
10+
for details.
11+
12+
## ArangoView.exists
13+
14+
```
15+
ArangoView.exists() : boolean
16+
```
17+
18+
Checks whether the view exists
19+
20+
**Examples**
21+
22+
```Java
23+
ArangoDB arango = new ArangoDB.Builder().build();
24+
ArangoDatabase db = arango.db("myDB");
25+
ArangoView view = db.view("potatos");
26+
27+
boolean exists = view.exists();
28+
```
29+
30+
## ArangoView.getInfo
31+
32+
```
33+
ArangoView.getInfo() : ViewEntity
34+
```
35+
36+
Returns information about the view.
37+
38+
**Examples**
39+
40+
```Java
41+
ArangoDB arango = new ArangoDB.Builder().build();
42+
ArangoDatabase db = arango.db("myDB");
43+
ArangoView view = db.view("potatos");
44+
45+
ViewEntity info = view.getInfo();
46+
```
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Manipulating the view
2+
3+
These functions implement
4+
[the HTTP API for modifying views](https://docs.arangodb.com/latest/HTTP/Views/Modifying.html).
5+
6+
## ArangoDatabase.createView
7+
8+
```
9+
ArangoDatabase.createView(String name, ViewType type) : ViewEntity
10+
```
11+
12+
Creates a view of the given _type_, then returns view information from the server.
13+
14+
**Arguments**
15+
16+
- **name**: `String`
17+
18+
The name of the view
19+
20+
- **type**: `ViewType`
21+
22+
The type of the view
23+
24+
**Examples**
25+
26+
```Java
27+
ArangoDB arango = new ArangoDB.Builder().build();
28+
ArangoDatabase db = arango.db("myDB");
29+
db.createView("myView", ViewType.ARANGO_SEARCH);
30+
// the view "potatos" now exists
31+
```
32+
33+
## ArangoView.rename
34+
35+
```
36+
ArangoView.rename(String newName) : ViewEntity
37+
```
38+
39+
Renames the view.
40+
41+
**Arguments**
42+
43+
- **newName**: `String`
44+
45+
The new name
46+
47+
**Examples**
48+
49+
```Java
50+
ArangoDB arango = new ArangoDB.Builder().build();
51+
ArangoDatabase db = arango.db("myDB");
52+
ArangoView view = db.view("some-view");
53+
54+
ViewEntity result = view.rename("new-view-name")
55+
assertThat(result.getName(), is("new-view-name");
56+
// result contains additional information about the view
57+
```
58+
59+
## ArangoView.drop
60+
61+
```
62+
ArangoView.drop() : void
63+
```
64+
65+
Deletes the view from the database.
66+
67+
**Examples**
68+
69+
```Java
70+
ArangoDB arango = new ArangoDB.Builder().build();
71+
ArangoDatabase db = arango.db("myDB");
72+
ArangoView view = db.view("some-view");
73+
74+
view.drop();
75+
// the view "some-view" no longer exists
76+
```

0 commit comments

Comments
 (0)