Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -320,15 +320,6 @@ Mono<Response<IndexDocumentsResult>> deleteDocumentsWithResponse(Iterable<?> doc
return indexDocumentsWithResponse(buildIndexBatch(documents, IndexActionType.DELETE), context);
}

/**
* Gets the version of the Search service the client is using.
*
* @return The version of the Search service the client is using.
*/
public SearchServiceVersion getServiceVersion() {
return this.serviceVersion;
}

/**
* Gets the endpoint for the Azure Cognitive Search service.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,6 @@ public Response<IndexDocumentsResult> deleteDocumentsWithResponse(Iterable<?> do
return asyncClient.deleteDocumentsWithResponse(documents, context).block();
}

/**

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sync client APIs are missing @ServiceMethod annotation and codesnippets too.

* Gets the version of the Search service the client is using.
*
* @return The version of the Search service the client is using.
*/
public SearchServiceVersion getServiceVersion() {
return asyncClient.getServiceVersion();
}

/**
* Gets the endpoint for the Azure Cognitive Search service.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,6 @@ HttpPipeline getHttpPipeline() {
return this.httpPipeline;
}

/**
* Gets search service version.
*
* @return the search service version value.
*/
public SearchServiceVersion getServiceVersion() {
return this.serviceVersion;
}

/**
* Gets the endpoint for the Azure Cognitive Search service.
*
Expand Down Expand Up @@ -268,6 +259,15 @@ PagedFlux<SearchIndex> listIndexes(RequestOptions requestOptions, Context contex
}
}

/**
* Lists all indexes names for an Azure Cognitive Search service.
*
* @return a reactive response emitting the list of index names.
*/
public PagedFlux<String> listIndexNames() {
return listIndexNames(null);
}

/**
* Lists all indexes names for an Azure Cognitive Search service.
*
Expand Down Expand Up @@ -542,6 +542,15 @@ PagedFlux<SynonymMap> listSynonymMaps(RequestOptions requestOptions, Context con
}
}

/**
* Lists all synonym map names for an Azure Cognitive Search service.
*
* @return a reactive response emitting the list of synonym map names.
*/
public PagedFlux<String> listSynonymMapNames() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All APIs in this client are missing @ServiceMethod annotation. Also, add codesnippets where appropriate.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add @ServiceMethod.

Can improve JavaDoc and other documents in preview 5.

return listIndexNames(null);
}

/**
* Lists all synonym map names for an Azure Cognitive Search service.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@
import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;
import com.azure.search.documents.SearchClient;
import com.azure.search.documents.SearchServiceVersion;
import com.azure.search.documents.indexes.models.AnalyzeRequest;
import com.azure.search.documents.indexes.models.AnalyzedTokenInfo;
import com.azure.search.documents.indexes.models.GetIndexStatisticsResult;
import com.azure.search.documents.models.RequestOptions;
import com.azure.search.documents.indexes.models.SearchIndex;
import com.azure.search.documents.indexes.models.ServiceStatistics;
import com.azure.search.documents.indexes.models.SynonymMap;
import com.azure.search.documents.models.RequestOptions;

/**
* Synchronous Client to manage and query indexes, as well as manage Synonym Map, on a Cognitive Search service
Expand All @@ -37,15 +36,6 @@ HttpPipeline getHttpPipeline() {
return this.asyncClient.getHttpPipeline();
}

/**
* Gets search service version.
*
* @return the search service version value.
*/
public SearchServiceVersion getServiceVersion() {
return this.asyncClient.getServiceVersion();
}

/**
* Gets the endpoint for the Azure Cognitive Search service.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,6 @@ HttpPipeline getHttpPipeline() {
return this.httpPipeline;
}

/**
* Gets search service version.
*
* @return the search service version value.
*/
public SearchServiceVersion getServiceVersion() {
return this.serviceVersion;
}

/**
* Gets the endpoint for the Azure Cognitive Search service.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;
import com.azure.search.documents.SearchServiceVersion;
import com.azure.search.documents.indexes.models.SearchIndexer;
import com.azure.search.documents.indexes.models.SearchIndexerDataSourceConnection;
import com.azure.search.documents.indexes.models.SearchIndexerSkillset;
Expand All @@ -33,15 +32,6 @@ HttpPipeline getHttpPipeline() {
return this.asyncClient.getHttpPipeline();
}

/**
* Gets search service version.
*
* @return the search service version value.
*/
public SearchServiceVersion getServiceVersion() {
return this.asyncClient.getServiceVersion();
}

/**
* Gets the endpoint for the Azure Cognitive Search service.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,47 +72,6 @@ public void buildAsyncClientUsingDefaultApiVersionTest() {
assertEquals(SearchAsyncClient.class.getSimpleName(), client.getClass().getSimpleName());
}

@Test
public void whenApiVersionSpecifiedThenSpecifiedValueExists() {
SearchServiceVersion expectedVersion = SearchServiceVersion.V2019_05_06_Preview;

SearchClient searchClient = new SearchClientBuilder()
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.indexName(indexName)
.serviceVersion(expectedVersion)
.buildClient();

assertEquals(expectedVersion, searchClient.getServiceVersion());

SearchAsyncClient asyncClient = new SearchClientBuilder()
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.indexName(indexName)
.serviceVersion(expectedVersion)
.buildAsyncClient();
assertEquals(expectedVersion, asyncClient.getServiceVersion());
}

@Test
public void whenBuildAsyncClientUsingDefaultApiVersionThenSuccess() {
SearchClient client = new SearchClientBuilder()
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.indexName(indexName)
.buildClient();

assertEquals(apiVersion, client.getServiceVersion());

SearchAsyncClient asyncClient = new SearchClientBuilder()
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.indexName(indexName)
.buildAsyncClient();

assertEquals(apiVersion, asyncClient.getServiceVersion());
}

@Test
public void whenBuildClientAndVerifyPropertiesThenSuccess() {
SearchClient client = new SearchClientBuilder()
Expand All @@ -123,7 +82,6 @@ public void whenBuildClientAndVerifyPropertiesThenSuccess() {

assertEquals(searchEndpoint, client.getEndpoint());
assertEquals(indexName, client.getIndexName());
assertEquals(apiVersion, client.getServiceVersion());

SearchAsyncClient asyncClient = new SearchClientBuilder()
.endpoint(searchEndpoint)
Expand All @@ -133,7 +91,6 @@ public void whenBuildClientAndVerifyPropertiesThenSuccess() {

assertEquals(searchEndpoint, asyncClient.getEndpoint());
assertEquals(indexName, asyncClient.getIndexName());
assertEquals(apiVersion, asyncClient.getServiceVersion());
}

@Test
Expand Down Expand Up @@ -162,42 +119,6 @@ public void credentialWithEmptyApiKeyThrowsIllegalArgumentException() {
.credential(new AzureKeyCredential("")));
}

@Test
public void nullApiVersionUsesLatest() {
SearchClientBuilder builder = new SearchClientBuilder()
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.indexName(indexName)
.serviceVersion(null);

assertEquals(SearchServiceVersion.getLatest(), builder.buildAsyncClient().getServiceVersion());
assertEquals(SearchServiceVersion.getLatest(), builder.buildClient().getServiceVersion());
}

@Test
public void verifyNewBuilderSetsLatestVersion() {
SearchClient searchClient = new SearchClientBuilder()
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.indexName("indexName")
.buildClient();

assertEquals(SearchServiceVersion.getLatest().getVersion(),
searchClient.getServiceVersion().getVersion());
}

@Test
public void verifyNewBuilderSetsLatestVersionAsync() {
SearchAsyncClient searchAsyncClient = new SearchClientBuilder()
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.indexName("indexName")
.buildAsyncClient();

assertEquals(SearchServiceVersion.getLatest().getVersion(),
searchAsyncClient.getServiceVersion().getVersion());
}

@Test
public void indexClientFreshDateOnRetry() throws MalformedURLException {
byte[] randomData = new byte[256];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public void canGetIndexClientFromSearchClient() {

// Validate the client points to the same instance
assertEquals(serviceClient.getEndpoint(), searchClient.getEndpoint());
assertEquals(serviceClient.getServiceVersion(), searchClient.getServiceVersion());

// Validate that the client uses the same HTTP pipeline for authentication, retries, etc
HttpPipeline servicePipeline = IndexesTestHelpers.getHttpPipeline(serviceClient);
Expand All @@ -50,7 +49,6 @@ public void canGetIndexAsyncClientFromSearchClient() {

// Validate the client points to the same instance
assertEquals(indexAsyncClient.getEndpoint(), searchAsyncClient.getEndpoint());
assertEquals(indexAsyncClient.getServiceVersion(), searchAsyncClient.getServiceVersion());

// Validate that the client uses the same HTTP pipeline for authentication, retries, etc
HttpPipeline servicePipeline = IndexesTestHelpers.getHttpPipeline(indexAsyncClient);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,26 +77,6 @@ public void buildAsyncClientUsingDefaultApiVersionTest() {
assertEquals(SearchIndexAsyncClient.class.getSimpleName(), client.getClass().getSimpleName());
}

@Test
public void whenApiVersionSpecifiedThenSpecifiedValueExists() {
SearchServiceVersion expectedApiVersion = SearchServiceVersion.V2019_05_06_Preview;

SearchIndexClient client = new SearchIndexClientBuilder()
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.serviceVersion(expectedApiVersion)
.buildClient();

assertEquals(expectedApiVersion.getVersion(), client.getServiceVersion().getVersion());

SearchIndexAsyncClient asyncClient = new SearchIndexClientBuilder()
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.serviceVersion(expectedApiVersion)
.buildAsyncClient();
assertEquals(expectedApiVersion.getVersion(), asyncClient.getServiceVersion().getVersion());
}

@Test
public void whenBuildClientAndVerifyPropertiesThenSuccess() {
SearchIndexClient client = new SearchIndexClientBuilder()
Expand All @@ -105,7 +85,6 @@ public void whenBuildClientAndVerifyPropertiesThenSuccess() {
.buildClient();

assertEquals(searchEndpoint, client.getEndpoint());
assertEquals(apiVersion, client.getServiceVersion());

SearchIndexAsyncClient asyncClient = new SearchIndexClientBuilder()
.endpoint(searchEndpoint)
Expand All @@ -114,7 +93,6 @@ public void whenBuildClientAndVerifyPropertiesThenSuccess() {
.buildAsyncClient();

assertEquals(searchEndpoint, asyncClient.getEndpoint());
assertEquals(apiVersion, asyncClient.getServiceVersion());
}

@Test
Expand All @@ -133,37 +111,6 @@ public void credentialWithEmptyApiKeyThrowsIllegalArgumentException() {
.credential(new AzureKeyCredential("")));
}

@Test
void nullApiVersionSetsLatest() {
SearchIndexClientBuilder builder = new SearchIndexClientBuilder()
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.serviceVersion(null);

assertEquals(SearchServiceVersion.getLatest(), builder.buildAsyncClient().getServiceVersion());
assertEquals(SearchServiceVersion.getLatest(), builder.buildClient().getServiceVersion());
}

@Test
public void verifyEmptyApiVersionSetsLatest() {
SearchIndexClient searchIndexClient = new SearchIndexClientBuilder()
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.buildClient();

assertEquals(SearchServiceVersion.getLatest(), searchIndexClient.getServiceVersion());
}

@Test
public void verifyEmptyApiVersionSetsLatestAsync() {
SearchIndexAsyncClient searchIndexAsyncClient = new SearchIndexClientBuilder()
.endpoint(searchEndpoint)
.credential(searchApiKeyCredential)
.buildAsyncClient();

assertEquals(SearchServiceVersion.getLatest(), searchIndexAsyncClient.getServiceVersion());
}

@Test
public void serviceClientFreshDateOnRetry() throws MalformedURLException {
byte[] randomData = new byte[256];
Expand Down
Loading