Skip to content

[DE-384] search-alias views #461

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 7 commits into from
Sep 16, 2022
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
25 changes: 24 additions & 1 deletion src/main/java/com/arangodb/ArangoDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.arangodb.model.*;
import com.arangodb.model.arangosearch.AnalyzerDeleteOptions;
import com.arangodb.model.arangosearch.ArangoSearchCreateOptions;
import com.arangodb.model.arangosearch.SearchAliasCreateOptions;

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

/**
* Returns a {@code ArangoSearch} instance for the given ArangoSearch view name.
* Returns a {@link ArangoSearch} instance for the given view name.
*
* @param name Name of the view
* @return ArangoSearch view handler
* @since ArangoDB 3.4.0
*/
ArangoSearch arangoSearch(String name);

/**
* Returns a {@link SearchAlias} instance for the given view name.
*
* @param name Name of the view
* @return SearchAlias view handler
* @since ArangoDB 3.10
*/
SearchAlias searchAlias(String name);

/**
* Creates a view of the given {@code type}, then returns view information from the server.
*
Expand All @@ -735,6 +745,19 @@ <V, E> TraversalEntity<V, E> executeTraversal(Class<V> vertexClass, Class<E> edg
*/
ViewEntity createArangoSearch(String name, ArangoSearchCreateOptions options) throws ArangoDBException;

/**
* Creates a SearchAlias view with the given {@code options}, then returns view information from the server.
*
* @param name The name of the view
* @param options Additional options, can be null
* @return information about the view
* @throws ArangoDBException
* @see <a href="https://www.arangodb.com/docs/stable/http/views-search-alias.html#create-a-search-alias-view">API
* Documentation</a>
* @since ArangoDB 3.10
*/
ViewEntity createSearchAlias(String name, SearchAliasCreateOptions options) throws ArangoDBException;

/**
* Creates an Analyzer
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/arangodb/ArangoSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* Interface for operations on ArangoDB view level for ArangoSearch views.
*
* @author Mark Vollmary
* @see <a href="https://www.arangodb.com/docs/stable/http/views.html">View API Documentation</a>
* @see <a href="https://www.arangodb.com/docs/stable/http/views-arangosearch.html">View API Documentation</a>
* @since ArangoDB 3.4.0
*/
public interface ArangoSearch extends ArangoView {
Expand Down
92 changes: 92 additions & 0 deletions src/main/java/com/arangodb/SearchAlias.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* DISCLAIMER
*
* Copyright 2018 ArangoDB GmbH, Cologne, Germany
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright holder is ArangoDB GmbH, Cologne, Germany
*/

package com.arangodb;

import com.arangodb.entity.ViewEntity;
import com.arangodb.entity.arangosearch.SearchAliasPropertiesEntity;
import com.arangodb.model.arangosearch.SearchAliasCreateOptions;
import com.arangodb.model.arangosearch.SearchAliasPropertiesOptions;

/**
* Interface for operations on ArangoDB view level for SearchAlias views.
*
* @author Michele Rastelli
* @see <a href="https://www.arangodb.com/docs/stable/http/views-search-alias.html">View API Documentation</a>
* @since ArangoDB 3.10
*/
public interface SearchAlias extends ArangoView {

/**
* Creates a view, then returns view information from the server.
*
* @return information about the view
* @throws ArangoDBException
* @see <a href="https://www.arangodb.com/docs/stable/http/views-search-alias.html#create-a-search-alias-view">API
* Documentation</a>
*/
ViewEntity create() throws ArangoDBException;

/**
* Creates a view with the given {@code options}, then returns view information from the server.
*
* @param options Additional options, can be null
* @return information about the view
* @throws ArangoDBException
* @see <a href="https://www.arangodb.com/docs/stable/http/views-search-alias.html#create-a-search-alias-view">API
* Documentation</a>
*/
ViewEntity create(SearchAliasCreateOptions options) throws ArangoDBException;

/**
* Reads the properties of the specified view.
*
* @return properties of the view
* @throws ArangoDBException
* @see <a href="https://www.arangodb.com/docs/stable/http/views-search-alias.html#read-properties-of-a-view">API
* Documentation</a>
*/
SearchAliasPropertiesEntity getProperties() throws ArangoDBException;

/**
* Partially changes properties of the view.
*
* @param options properties to change
* @return properties of the view
* @throws ArangoDBException
* @see <a href=
* "https://www.arangodb.com/docs/stable/http/views-search-alias.html#partially-changes-properties-of-a-search-alias-view">API
* Documentation</a>
*/
SearchAliasPropertiesEntity updateProperties(SearchAliasPropertiesOptions options) throws ArangoDBException;

/**
* Changes properties of the view.
*
* @param options properties to change
* @return properties of the view
* @throws ArangoDBException
* @see <a href=
* "https://www.arangodb.com/docs/stable/http/views-search-alias.html#changes-properties-of-a-search-alias-view">API
* Documentation</a>
*/
SearchAliasPropertiesEntity replaceProperties(SearchAliasPropertiesOptions options) throws ArangoDBException;

}
24 changes: 23 additions & 1 deletion src/main/java/com/arangodb/async/ArangoDatabaseAsync.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.arangodb.model.*;
import com.arangodb.model.arangosearch.AnalyzerDeleteOptions;
import com.arangodb.model.arangosearch.ArangoSearchCreateOptions;
import com.arangodb.model.arangosearch.SearchAliasCreateOptions;

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

/**
* Returns a {@code ArangoSearchAsync} instance for the given ArangoSearch view name.
* Returns a {@link ArangoSearchAsync} instance for the given ArangoSearch view name.
*
* @param name Name of the view
* @return ArangoSearch view handler
* @since ArangoDB 3.4.0
*/
ArangoSearchAsync arangoSearch(String name);

/**
* Returns a {@link SearchAliasAsync} instance for the given view name.
*
* @param name Name of the view
* @return SearchAlias view handler
* @since ArangoDB 3.10
*/
SearchAliasAsync searchAlias(String name);

/**
* Creates a view of the given {@code type}, then returns view information from the server.
*
Expand All @@ -712,6 +722,18 @@ <T> CompletableFuture<T> getDocument(final String id, final Class<T> type, final
*/
CompletableFuture<ViewEntity> createArangoSearch(String name, ArangoSearchCreateOptions options);

/**
* Creates a SearchAlias view with the given {@code options}, then returns view information from the server.
*
* @param name The name of the view
* @param options Additional options, can be null
* @return information about the view
* @see <a href="https://www.arangodb.com/docs/stable/http/views-search-alias.html#create-a-search-alias-view">API
* Documentation</a>
* @since ArangoDB 3.10
*/
CompletableFuture<ViewEntity> createSearchAlias(String name, SearchAliasCreateOptions options);

/**
* Creates an Analyzer
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/arangodb/async/ArangoSearchAsync.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* Interface for operations on ArangoDB view level for ArangoSearch views.
*
* @author Mark Vollmary
* @see <a href="https://www.arangodb.com/docs/stable/http/views.html">View API Documentation</a>
* @see <a href="https://www.arangodb.com/docs/stable/http/views-arangosearch.html">View API Documentation</a>
* @since ArangoDB 3.4.0
*/
public interface ArangoSearchAsync extends ArangoViewAsync {
Expand Down
89 changes: 89 additions & 0 deletions src/main/java/com/arangodb/async/SearchAliasAsync.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* DISCLAIMER
*
* Copyright 2018 ArangoDB GmbH, Cologne, Germany
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright holder is ArangoDB GmbH, Cologne, Germany
*/

package com.arangodb.async;

import com.arangodb.entity.ViewEntity;
import com.arangodb.entity.arangosearch.SearchAliasPropertiesEntity;
import com.arangodb.model.arangosearch.SearchAliasCreateOptions;
import com.arangodb.model.arangosearch.SearchAliasPropertiesOptions;

import java.util.concurrent.CompletableFuture;

/**
* Interface for operations on ArangoDB view level for SearchAlias views.
*
* @author Michele Rastelli
* @see <a href="https://www.arangodb.com/docs/stable/http/views-search-alias.html">View API Documentation</a>
* @since ArangoDB 3.10
*/
public interface SearchAliasAsync extends ArangoViewAsync {

/**
* Creates a view, then returns view information from the server.
*
* @return information about the view
* @see <a href="https://www.arangodb.com/docs/stable/http/views-search-alias.html#create-a-search-alias-view">API
* Documentation</a>
*/
CompletableFuture<ViewEntity> create();

/**
* Creates a view with the given {@code options}, then returns view information from the server.
*
* @param options Additional options, can be null
* @return information about the view
* @see <a href="https://www.arangodb.com/docs/stable/http/views-search-alias.html#create-a-search-alias-view">API
* Documentation</a>
*/
CompletableFuture<ViewEntity> create(SearchAliasCreateOptions options);

/**
* Reads the properties of the specified view.
*
* @return properties of the view
* @see <a href="https://www.arangodb.com/docs/stable/http/views-search-alias.html#read-properties-of-a-view">API
* Documentation</a>
*/
CompletableFuture<SearchAliasPropertiesEntity> getProperties();

/**
* Partially changes properties of the view.
*
* @param options properties to change
* @return properties of the view
* @see <a href=
* "https://www.arangodb.com/docs/stable/http/views-search-alias.html#partially-changes-properties-of-a-search-alias-view">API
* Documentation</a>
*/
CompletableFuture<SearchAliasPropertiesEntity> updateProperties(SearchAliasPropertiesOptions options);

/**
* Changes properties of the view.
*
* @param options properties to change
* @return properties of the view
* @see <a href=
* "https://www.arangodb.com/docs/stable/http/views-search-alias.html#changes-properties-of-a-search-alias-view">API
* Documentation</a>
*/
CompletableFuture<SearchAliasPropertiesEntity> replaceProperties(SearchAliasPropertiesOptions options);

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,7 @@

import com.arangodb.ArangoDBException;
import com.arangodb.DbName;
import com.arangodb.async.ArangoCollectionAsync;
import com.arangodb.async.ArangoCursorAsync;
import com.arangodb.async.ArangoDatabaseAsync;
import com.arangodb.async.ArangoGraphAsync;
import com.arangodb.async.ArangoRouteAsync;
import com.arangodb.async.ArangoSearchAsync;
import com.arangodb.async.ArangoViewAsync;
import com.arangodb.async.*;
import com.arangodb.entity.*;
import com.arangodb.entity.arangosearch.AnalyzerEntity;
import com.arangodb.entity.arangosearch.analyzer.SearchAnalyzer;
Expand All @@ -51,6 +45,7 @@
import com.arangodb.model.TraversalOptions;
import com.arangodb.model.arangosearch.AnalyzerDeleteOptions;
import com.arangodb.model.arangosearch.ArangoSearchCreateOptions;
import com.arangodb.model.arangosearch.SearchAliasCreateOptions;
import com.arangodb.velocypack.Type;
import com.arangodb.velocystream.Request;

Expand Down Expand Up @@ -450,6 +445,11 @@ public ArangoSearchAsync arangoSearch(final String name) {
return new ArangoSearchAsyncImpl(this, name);
}

@Override
public SearchAliasAsync searchAlias(String name) {
return new SearchAliasAsyncImpl(this, name);
}

@Override
public CompletableFuture<ViewEntity> createView(final String name, final ViewType type) {
return executor.execute(createViewRequest(name, type), ViewEntity.class);
Expand All @@ -460,6 +460,11 @@ public CompletableFuture<ViewEntity> createArangoSearch(final String name, final
return executor.execute(createArangoSearchRequest(name, options), ViewEntity.class);
}

@Override
public CompletableFuture<ViewEntity> createSearchAlias(String name, SearchAliasCreateOptions options) {
return executor.execute(createSearchAliasRequest(name, options), ViewEntity.class);
}

@Override
public CompletableFuture<AnalyzerEntity> createAnalyzer(AnalyzerEntity options) {
return executor.execute(createAnalyzerRequest(options), AnalyzerEntity.class);
Expand Down
Loading