Skip to content

Commit

Permalink
Fix some of intellij warnings (Azure#345)
Browse files Browse the repository at this point in the history
* move IndexAction back to modles, update autorest config, update samples

* change SuggestOptionsHandler access modifier to package-private

* Update DataSources.java
  • Loading branch information
navalev authored Dec 17, 2019
1 parent cb4dc62 commit c9e3a9d
Show file tree
Hide file tree
Showing 18 changed files with 28 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public static DataSource azureTableStorage(
/**
* Creates a new DataSource to connect to a Cosmos database.
*
* @param name The name of the datasource.
* @param name The name of the data source.
* @param cosmosConnectionString The connection string for the Cosmos database. It must follow this format:
* AccountName|AccountEndpoint=[your account name or endpoint];
* AccountKey=[your account key];Database=[your database name]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import com.azure.search.models.AutocompleteOptions;
import com.azure.search.models.AutocompleteRequest;
import com.azure.search.models.DocumentIndexResult;
import com.azure.search.implementation.models.IndexAction;
import com.azure.search.models.IndexAction;
import com.azure.search.implementation.models.IndexActionType;
import com.azure.search.models.IndexBatch;
import com.azure.search.models.RequestOptions;
Expand Down Expand Up @@ -476,7 +476,7 @@ Mono<Response<DocumentIndexResult>> indexWithResponse(IndexBatch<?> batch, Conte
}

/**
* Autocompletes incomplete query terms based on input text and matching terms in the Azure Cognitive Search index.
* Autocomplete incomplete query terms based on input text and matching terms in the Azure Cognitive Search index.
*
* @param searchText search text
* @param suggesterName suggester name
Expand All @@ -488,7 +488,7 @@ public PagedFluxBase<AutocompleteItem, AutocompletePagedResponse> autocomplete(
}

/**
* Autocompletes incomplete query terms based on input text and matching terms in the Azure Cognitive Search index.
* Autocomplete incomplete query terms based on input text and matching terms in the Azure Cognitive Search index.
*
* @param searchText search text
* @param suggesterName suggester name
Expand Down Expand Up @@ -569,7 +569,7 @@ private Mono<SearchPagedResponse> searchNextPage(

// Extract the value of top and skip from @search.nextPageParameters in SearchPagedResponse
ObjectMapper objectMapper = new ObjectMapper();
SearchRequest nextPageRequest = null;
SearchRequest nextPageRequest;
try {
nextPageRequest = objectMapper.readValue(nextPageParameters, SearchRequest.class);
} catch (JsonProcessingException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public Response<DocumentIndexResult> indexWithResponse(IndexBatch<?> batch, Cont
}

/**
* Autocompletes incomplete query terms based on input text and matching terms in the Azure Cognitive Search index.
* Autocomplete incomplete query terms based on input text and matching terms in the Azure Cognitive Search index.
*
* @param searchText search text
* @param suggesterName suggester name
Expand All @@ -333,7 +333,7 @@ public PagedIterableBase<AutocompleteItem, AutocompletePagedResponse> autocomple
}

/**
* Autocompletes incomplete query terms based on input text and matching terms in the Azure Cognitive Search index.
* Autocomplete incomplete query terms based on input text and matching terms in the Azure Cognitive Search index.
*
* @param searchText search text
* @param suggesterName suggester name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* TODO: Add class description
*/
public class SuggestOptionsHandler {
class SuggestOptionsHandler {

/**
* Ensure all suggest parameters are correct
Expand All @@ -17,7 +17,7 @@ public class SuggestOptionsHandler {
* @param suggestOptions suggest parameters
* @return SuggestOptions ensured suggest parameters
*/
public static SuggestOptions ensureSuggestOptions(SuggestOptions suggestOptions) {
static SuggestOptions ensureSuggestOptions(SuggestOptions suggestOptions) {
if (suggestOptions == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package com.azure.search.implementation.models;

import com.azure.core.annotation.Fluent;
import com.azure.search.models.IndexAction;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
@Fluent
public class CoordinateSystem {
public static final String NAME_PROPERTY = "name";
private static final String NAME_PROPERTY = "name";

@JsonProperty
private String type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

package com.azure.search.implementation.models;
package com.azure.search.models;

import com.azure.core.annotation.Fluent;
import com.azure.search.implementation.models.IndexActionType;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import com.azure.core.annotation.Fluent;
import com.azure.search.Document;
import com.azure.search.implementation.models.IndexAction;
import com.azure.search.implementation.models.IndexActionType;
import com.azure.search.implementation.models.IndexBatchImpl;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public class HttpResponseExceptionExample {
private static final String ENDPOINT = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_ENDPOINT");
private static final String API_KEY = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_API_KEY");

private static final String INDEX_NAME = "hotels-sample-index";

public static void main(String[] args) {
handleErrorsWithSyncClient();
handleErrorsWithAsyncClient();
Expand All @@ -40,7 +42,7 @@ private static void handleErrorsWithSyncClient() {
SearchIndexClient client = new SearchIndexClientBuilder()
.endpoint(ENDPOINT)
.credential(new SearchApiKeyCredential(API_KEY))
.indexName("hotels")
.indexName(INDEX_NAME)
.buildClient();

try {
Expand Down Expand Up @@ -71,7 +73,7 @@ private static void handleErrorsWithAsyncClient() {
SearchIndexAsyncClient client = new SearchIndexClientBuilder()
.endpoint(ENDPOINT)
.credential(new SearchApiKeyCredential(API_KEY))
.indexName("hotels")
.indexName(INDEX_NAME)
.buildAsyncClient();

SearchOptions searchOptions = new SearchOptions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class IndexAndServiceStatisticsExample {
* populate ADMIN_KEY and SEARCH_SERVICE_NAME.
*/
private static final String ENDPOINT = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_ENDPOINT");
private static final String ADMIN_KEY = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_API_KEY");
private static final String ADMIN_KEY = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_ADMIN_KEY");

public static void main(String[] args) {
SearchServiceClient client = createClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class IndexContentManagementExample {
* and set the values of these environment variables:
*/
private static final String ENDPOINT = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_ENDPOINT");
private static final String API_KEY = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_API_KEY");
private static final String ADMIN_KEY = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_ADMIN_KEY");

private static final String INDEX_NAME = "hotels-sample-index";

Expand All @@ -40,7 +40,7 @@ public static void main(String[] args) {
private static void basicIndexing() {
SearchIndexClient client = new SearchIndexClientBuilder()
.endpoint(ENDPOINT)
.credential(new SearchApiKeyCredential(API_KEY))
.credential(new SearchApiKeyCredential(ADMIN_KEY))
.indexName(INDEX_NAME)
.buildClient();

Expand All @@ -60,7 +60,7 @@ private static void basicIndexing() {
private static void advancedIndexing() {
SearchIndexClient client = new SearchIndexClientBuilder()
.endpoint(ENDPOINT)
.credential(new SearchApiKeyCredential(API_KEY))
.credential(new SearchApiKeyCredential(ADMIN_KEY))
.indexName(INDEX_NAME)
.buildClient();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class LifecycleSetupExample {
* and set the values of these environment variables:
*/
private static final String ENDPOINT = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_ENDPOINT");
private static final String ADMIN_KEY = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_API_KEY");
private static final String ADMIN_KEY = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_ADMIN_KEY");

// Using hard coded connection string to pre-populated Cosmos DB database with sample data set
// For more information visit https://docs.microsoft.com/en-us/samples/azure-samples/azure-search-sample-data/azure-search-sample-data/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class ListIndexersExample {
private static final String ENDPOINT = Configuration.getGlobalConfiguration()
.get("AZURE_COGNITIVE_SEARCH_ENDPOINT");
private static final String ADMIN_KEY = Configuration.getGlobalConfiguration()
.get("AZURE_COGNITIVE_SEARCH_API_KEY");
.get("AZURE_COGNITIVE_SEARCH_ADMIN_KEY");

public static void main(String[] args) {
SearchServiceAsyncClient searchServiceClient = new SearchServiceClientBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class RefineSearchCapabilitiesExample {
* and set the values of these environment variables:
*/
private static final String ENDPOINT = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_ENDPOINT");
private static final String ADMIN_KEY = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_API_KEY");
private static final String ADMIN_KEY = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_ADMIN_KEY");

private static final String INDEX_NAME = "hotels-sample-index";
private static final String INDEXER_NAME = "hotels-sample-indexer";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class RunningSearchSolutionExample {
* and set the values of these environment variables:
*/
private static final String ENDPOINT = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_ENDPOINT");
private static final String ADMIN_KEY = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_API_KEY");
private static final String ADMIN_KEY = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_ADMIN_KEY");

private static final String INDEX_NAME = "hotels-sample-index";
private static final String INDEXER_NAME = "hotels-sample-indexer";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class SynonymMapsCreateExample {
* and set the values of these environment variables:
*/
private static final String ENDPOINT = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_ENDPOINT");
private static final String API_ADMIN_KEY = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_API_KEY");
private static final String API_ADMIN_KEY = Configuration.getGlobalConfiguration().get("AZURE_COGNITIVE_SEARCH_ADMIN_KEY");

public static void main(String[] args) {
SearchServiceClient serviceClient = new SearchServiceClientBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.
package com.azure.search;

import com.azure.search.implementation.models.IndexAction;
import com.azure.search.models.IndexAction;
import com.azure.search.implementation.models.IndexActionType;
import com.azure.search.models.IndexBatch;
import org.junit.Assert;
Expand Down
2 changes: 1 addition & 1 deletion sdk/search/open-api/data-readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sync-methods: none
add-context-parameter: true
generate-client-interfaces: false
custom-types-subpackage: implementation.models
custom-types: IndexActionType,IndexAction,IndexBatchImpl
custom-types: IndexActionType,IndexBatchImpl
license-header: |-
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
Expand Down

0 comments on commit c9e3a9d

Please sign in to comment.