Skip to content

Commit 2d175b0

Browse files
authored
[DE-384] search-alias views (#461)
* [DE-157] added support to inBackground parameter in ArangoSearch links * ViewType.SEARCH_ALIAS * SearchAlias sync * SearchAlias async * SearchAlias sync tests * disabled ArangoSearchTest for 3.10 cluster * SearchAlias async tests
1 parent 0f80bc0 commit 2d175b0

28 files changed

+1208
-54
lines changed

src/main/java/com/arangodb/ArangoDatabase.java

+24-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.arangodb.model.*;
2727
import com.arangodb.model.arangosearch.AnalyzerDeleteOptions;
2828
import com.arangodb.model.arangosearch.ArangoSearchCreateOptions;
29+
import com.arangodb.model.arangosearch.SearchAliasCreateOptions;
2930

3031
import java.util.Collection;
3132
import java.util.Map;
@@ -703,14 +704,23 @@ <V, E> TraversalEntity<V, E> executeTraversal(Class<V> vertexClass, Class<E> edg
703704
ArangoView view(String name);
704705

705706
/**
706-
* Returns a {@code ArangoSearch} instance for the given ArangoSearch view name.
707+
* Returns a {@link ArangoSearch} instance for the given view name.
707708
*
708709
* @param name Name of the view
709710
* @return ArangoSearch view handler
710711
* @since ArangoDB 3.4.0
711712
*/
712713
ArangoSearch arangoSearch(String name);
713714

715+
/**
716+
* Returns a {@link SearchAlias} instance for the given view name.
717+
*
718+
* @param name Name of the view
719+
* @return SearchAlias view handler
720+
* @since ArangoDB 3.10
721+
*/
722+
SearchAlias searchAlias(String name);
723+
714724
/**
715725
* Creates a view of the given {@code type}, then returns view information from the server.
716726
*
@@ -735,6 +745,19 @@ <V, E> TraversalEntity<V, E> executeTraversal(Class<V> vertexClass, Class<E> edg
735745
*/
736746
ViewEntity createArangoSearch(String name, ArangoSearchCreateOptions options) throws ArangoDBException;
737747

748+
/**
749+
* Creates a SearchAlias view with the given {@code options}, then returns view information from the server.
750+
*
751+
* @param name The name of the view
752+
* @param options Additional options, can be null
753+
* @return information about the view
754+
* @throws ArangoDBException
755+
* @see <a href="https://www.arangodb.com/docs/stable/http/views-search-alias.html#create-a-search-alias-view">API
756+
* Documentation</a>
757+
* @since ArangoDB 3.10
758+
*/
759+
ViewEntity createSearchAlias(String name, SearchAliasCreateOptions options) throws ArangoDBException;
760+
738761
/**
739762
* Creates an Analyzer
740763
*

src/main/java/com/arangodb/ArangoSearch.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* Interface for operations on ArangoDB view level for ArangoSearch views.
3030
*
3131
* @author Mark Vollmary
32-
* @see <a href="https://www.arangodb.com/docs/stable/http/views.html">View API Documentation</a>
32+
* @see <a href="https://www.arangodb.com/docs/stable/http/views-arangosearch.html">View API Documentation</a>
3333
* @since ArangoDB 3.4.0
3434
*/
3535
public interface ArangoSearch extends ArangoView {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/*
2+
* DISCLAIMER
3+
*
4+
* Copyright 2018 ArangoDB GmbH, Cologne, Germany
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
* Copyright holder is ArangoDB GmbH, Cologne, Germany
19+
*/
20+
21+
package com.arangodb;
22+
23+
import com.arangodb.entity.ViewEntity;
24+
import com.arangodb.entity.arangosearch.SearchAliasPropertiesEntity;
25+
import com.arangodb.model.arangosearch.SearchAliasCreateOptions;
26+
import com.arangodb.model.arangosearch.SearchAliasPropertiesOptions;
27+
28+
/**
29+
* Interface for operations on ArangoDB view level for SearchAlias views.
30+
*
31+
* @author Michele Rastelli
32+
* @see <a href="https://www.arangodb.com/docs/stable/http/views-search-alias.html">View API Documentation</a>
33+
* @since ArangoDB 3.10
34+
*/
35+
public interface SearchAlias extends ArangoView {
36+
37+
/**
38+
* Creates a view, then returns view information from the server.
39+
*
40+
* @return information about the view
41+
* @throws ArangoDBException
42+
* @see <a href="https://www.arangodb.com/docs/stable/http/views-search-alias.html#create-a-search-alias-view">API
43+
* Documentation</a>
44+
*/
45+
ViewEntity create() throws ArangoDBException;
46+
47+
/**
48+
* Creates a view with the given {@code options}, then returns view information from the server.
49+
*
50+
* @param options Additional options, can be null
51+
* @return information about the view
52+
* @throws ArangoDBException
53+
* @see <a href="https://www.arangodb.com/docs/stable/http/views-search-alias.html#create-a-search-alias-view">API
54+
* Documentation</a>
55+
*/
56+
ViewEntity create(SearchAliasCreateOptions options) throws ArangoDBException;
57+
58+
/**
59+
* Reads the properties of the specified view.
60+
*
61+
* @return properties of the view
62+
* @throws ArangoDBException
63+
* @see <a href="https://www.arangodb.com/docs/stable/http/views-search-alias.html#read-properties-of-a-view">API
64+
* Documentation</a>
65+
*/
66+
SearchAliasPropertiesEntity getProperties() throws ArangoDBException;
67+
68+
/**
69+
* Partially changes properties of the view.
70+
*
71+
* @param options properties to change
72+
* @return properties of the view
73+
* @throws ArangoDBException
74+
* @see <a href=
75+
* "https://www.arangodb.com/docs/stable/http/views-search-alias.html#partially-changes-properties-of-a-search-alias-view">API
76+
* Documentation</a>
77+
*/
78+
SearchAliasPropertiesEntity updateProperties(SearchAliasPropertiesOptions options) throws ArangoDBException;
79+
80+
/**
81+
* Changes properties of the view.
82+
*
83+
* @param options properties to change
84+
* @return properties of the view
85+
* @throws ArangoDBException
86+
* @see <a href=
87+
* "https://www.arangodb.com/docs/stable/http/views-search-alias.html#changes-properties-of-a-search-alias-view">API
88+
* Documentation</a>
89+
*/
90+
SearchAliasPropertiesEntity replaceProperties(SearchAliasPropertiesOptions options) throws ArangoDBException;
91+
92+
}

src/main/java/com/arangodb/async/ArangoDatabaseAsync.java

+23-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.arangodb.model.*;
3030
import com.arangodb.model.arangosearch.AnalyzerDeleteOptions;
3131
import com.arangodb.model.arangosearch.ArangoSearchCreateOptions;
32+
import com.arangodb.model.arangosearch.SearchAliasCreateOptions;
3233

3334
import java.util.Collection;
3435
import java.util.Map;
@@ -682,14 +683,23 @@ <T> CompletableFuture<T> getDocument(final String id, final Class<T> type, final
682683
ArangoViewAsync view(String name);
683684

684685
/**
685-
* Returns a {@code ArangoSearchAsync} instance for the given ArangoSearch view name.
686+
* Returns a {@link ArangoSearchAsync} instance for the given ArangoSearch view name.
686687
*
687688
* @param name Name of the view
688689
* @return ArangoSearch view handler
689690
* @since ArangoDB 3.4.0
690691
*/
691692
ArangoSearchAsync arangoSearch(String name);
692693

694+
/**
695+
* Returns a {@link SearchAliasAsync} instance for the given view name.
696+
*
697+
* @param name Name of the view
698+
* @return SearchAlias view handler
699+
* @since ArangoDB 3.10
700+
*/
701+
SearchAliasAsync searchAlias(String name);
702+
693703
/**
694704
* Creates a view of the given {@code type}, then returns view information from the server.
695705
*
@@ -712,6 +722,18 @@ <T> CompletableFuture<T> getDocument(final String id, final Class<T> type, final
712722
*/
713723
CompletableFuture<ViewEntity> createArangoSearch(String name, ArangoSearchCreateOptions options);
714724

725+
/**
726+
* Creates a SearchAlias view with the given {@code options}, then returns view information from the server.
727+
*
728+
* @param name The name of the view
729+
* @param options Additional options, can be null
730+
* @return information about the view
731+
* @see <a href="https://www.arangodb.com/docs/stable/http/views-search-alias.html#create-a-search-alias-view">API
732+
* Documentation</a>
733+
* @since ArangoDB 3.10
734+
*/
735+
CompletableFuture<ViewEntity> createSearchAlias(String name, SearchAliasCreateOptions options);
736+
715737
/**
716738
* Creates an Analyzer
717739
*

src/main/java/com/arangodb/async/ArangoSearchAsync.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* Interface for operations on ArangoDB view level for ArangoSearch views.
3232
*
3333
* @author Mark Vollmary
34-
* @see <a href="https://www.arangodb.com/docs/stable/http/views.html">View API Documentation</a>
34+
* @see <a href="https://www.arangodb.com/docs/stable/http/views-arangosearch.html">View API Documentation</a>
3535
* @since ArangoDB 3.4.0
3636
*/
3737
public interface ArangoSearchAsync extends ArangoViewAsync {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/*
2+
* DISCLAIMER
3+
*
4+
* Copyright 2018 ArangoDB GmbH, Cologne, Germany
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
* Copyright holder is ArangoDB GmbH, Cologne, Germany
19+
*/
20+
21+
package com.arangodb.async;
22+
23+
import com.arangodb.entity.ViewEntity;
24+
import com.arangodb.entity.arangosearch.SearchAliasPropertiesEntity;
25+
import com.arangodb.model.arangosearch.SearchAliasCreateOptions;
26+
import com.arangodb.model.arangosearch.SearchAliasPropertiesOptions;
27+
28+
import java.util.concurrent.CompletableFuture;
29+
30+
/**
31+
* Interface for operations on ArangoDB view level for SearchAlias views.
32+
*
33+
* @author Michele Rastelli
34+
* @see <a href="https://www.arangodb.com/docs/stable/http/views-search-alias.html">View API Documentation</a>
35+
* @since ArangoDB 3.10
36+
*/
37+
public interface SearchAliasAsync extends ArangoViewAsync {
38+
39+
/**
40+
* Creates a view, then returns view information from the server.
41+
*
42+
* @return information about the view
43+
* @see <a href="https://www.arangodb.com/docs/stable/http/views-search-alias.html#create-a-search-alias-view">API
44+
* Documentation</a>
45+
*/
46+
CompletableFuture<ViewEntity> create();
47+
48+
/**
49+
* Creates a view with the given {@code options}, then returns view information from the server.
50+
*
51+
* @param options Additional options, can be null
52+
* @return information about the view
53+
* @see <a href="https://www.arangodb.com/docs/stable/http/views-search-alias.html#create-a-search-alias-view">API
54+
* Documentation</a>
55+
*/
56+
CompletableFuture<ViewEntity> create(SearchAliasCreateOptions options);
57+
58+
/**
59+
* Reads the properties of the specified view.
60+
*
61+
* @return properties of the view
62+
* @see <a href="https://www.arangodb.com/docs/stable/http/views-search-alias.html#read-properties-of-a-view">API
63+
* Documentation</a>
64+
*/
65+
CompletableFuture<SearchAliasPropertiesEntity> getProperties();
66+
67+
/**
68+
* Partially changes properties of the view.
69+
*
70+
* @param options properties to change
71+
* @return properties of the view
72+
* @see <a href=
73+
* "https://www.arangodb.com/docs/stable/http/views-search-alias.html#partially-changes-properties-of-a-search-alias-view">API
74+
* Documentation</a>
75+
*/
76+
CompletableFuture<SearchAliasPropertiesEntity> updateProperties(SearchAliasPropertiesOptions options);
77+
78+
/**
79+
* Changes properties of the view.
80+
*
81+
* @param options properties to change
82+
* @return properties of the view
83+
* @see <a href=
84+
* "https://www.arangodb.com/docs/stable/http/views-search-alias.html#changes-properties-of-a-search-alias-view">API
85+
* Documentation</a>
86+
*/
87+
CompletableFuture<SearchAliasPropertiesEntity> replaceProperties(SearchAliasPropertiesOptions options);
88+
89+
}

src/main/java/com/arangodb/async/internal/ArangoDatabaseAsyncImpl.java

+12-7
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,7 @@
2222

2323
import com.arangodb.ArangoDBException;
2424
import com.arangodb.DbName;
25-
import com.arangodb.async.ArangoCollectionAsync;
26-
import com.arangodb.async.ArangoCursorAsync;
27-
import com.arangodb.async.ArangoDatabaseAsync;
28-
import com.arangodb.async.ArangoGraphAsync;
29-
import com.arangodb.async.ArangoRouteAsync;
30-
import com.arangodb.async.ArangoSearchAsync;
31-
import com.arangodb.async.ArangoViewAsync;
25+
import com.arangodb.async.*;
3226
import com.arangodb.entity.*;
3327
import com.arangodb.entity.arangosearch.AnalyzerEntity;
3428
import com.arangodb.entity.arangosearch.analyzer.SearchAnalyzer;
@@ -51,6 +45,7 @@
5145
import com.arangodb.model.TraversalOptions;
5246
import com.arangodb.model.arangosearch.AnalyzerDeleteOptions;
5347
import com.arangodb.model.arangosearch.ArangoSearchCreateOptions;
48+
import com.arangodb.model.arangosearch.SearchAliasCreateOptions;
5449
import com.arangodb.velocypack.Type;
5550
import com.arangodb.velocystream.Request;
5651

@@ -450,6 +445,11 @@ public ArangoSearchAsync arangoSearch(final String name) {
450445
return new ArangoSearchAsyncImpl(this, name);
451446
}
452447

448+
@Override
449+
public SearchAliasAsync searchAlias(String name) {
450+
return new SearchAliasAsyncImpl(this, name);
451+
}
452+
453453
@Override
454454
public CompletableFuture<ViewEntity> createView(final String name, final ViewType type) {
455455
return executor.execute(createViewRequest(name, type), ViewEntity.class);
@@ -460,6 +460,11 @@ public CompletableFuture<ViewEntity> createArangoSearch(final String name, final
460460
return executor.execute(createArangoSearchRequest(name, options), ViewEntity.class);
461461
}
462462

463+
@Override
464+
public CompletableFuture<ViewEntity> createSearchAlias(String name, SearchAliasCreateOptions options) {
465+
return executor.execute(createSearchAliasRequest(name, options), ViewEntity.class);
466+
}
467+
463468
@Override
464469
public CompletableFuture<AnalyzerEntity> createAnalyzer(AnalyzerEntity options) {
465470
return executor.execute(createAnalyzerRequest(options), AnalyzerEntity.class);

0 commit comments

Comments
 (0)