From d7f801aeb818ed2b5749591f5331ec272b59a64a Mon Sep 17 00:00:00 2001 From: alzimmermsft <48699787+alzimmermsft@users.noreply.github.com> Date: Wed, 9 Sep 2020 12:04:46 -0700 Subject: [PATCH 1/2] Renamed SearchableFieldProperty to SearchableField and SimpleFieldProperty to SimpleField and updated the CHANGELOG and README in preparation for release --- .../azure-search-documents/CHANGELOG.md | 38 ++++-- sdk/search/azure-search-documents/README.md | 120 +++++++++--------- .../implementation/util/FieldBuilder.java | 56 ++++---- .../documents/indexes/SearchableField.java | 93 ++++++++++++++ .../indexes/SearchableFieldProperty.java | 87 ------------- .../search/documents/indexes/SimpleField.java | 55 ++++++++ .../indexes/SimpleFieldProperty.java | 54 -------- .../azure/search/documents/models/Hotel.java | 8 +- .../test/environment/models/Foo.java | 4 +- .../test/environment/models/Hotel.java | 14 +- .../test/environment/models/HotelAddress.java | 14 +- .../models/HotelAnalyzerException.java | 4 +- .../models/HotelRenameProperty.java | 10 +- .../models/HotelSearchException.java | 4 +- .../HotelSearchableExceptionOnList.java | 4 +- .../environment/models/HotelWithArray.java | 8 +- .../models/HotelWithEmptyInSynonymMaps.java | 4 +- .../com/azure/search/perf/core/Address.java | 12 +- .../com/azure/search/perf/core/Hotel.java | 22 ++-- 19 files changed, 318 insertions(+), 293 deletions(-) create mode 100644 sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchableField.java delete mode 100644 sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchableFieldProperty.java create mode 100644 sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SimpleField.java delete mode 100644 sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SimpleFieldProperty.java diff --git a/sdk/search/azure-search-documents/CHANGELOG.md b/sdk/search/azure-search-documents/CHANGELOG.md index ddc366a4c37c8..f5aee93ee1004 100644 --- a/sdk/search/azure-search-documents/CHANGELOG.md +++ b/sdk/search/azure-search-documents/CHANGELOG.md @@ -1,9 +1,23 @@ # Release History -## 11.1.0-beta.2 (Unreleased) +## 11.1.0 (2020-09-09) +### New Features + +- GA release of `buildSearchFields` on `SearchIndexClient` and `SearchIndexAsyncClient`. +- GA release of `JsonSerializer` functionality for `SearchClient` and `SearchAsyncClient`. +- GA release of default `HttpLogOptions` on client builders. + +### Breaking Changes + +- Renamed `SearchableFieldProperty` to `SearchableField` and `SimpleFieldProperty` to `SimpleField`. +- Renamed `FieldBuilderOptions.setConverter` to `FieldBuilderOptions.setJsonSerializer`. - Replaced `ObjectSerializer` setters in builders with `JsonSerializer` to better represent the type requirement. +### Bug Fixes + +- Deprecated getter `OcrSkill.setShouldDetectOrientation()` and replaced with correct Javabeans named `isShouldDetectOrientation()`. + ## 11.1.0-beta.1 (2020-08-12) - Added `buildSearchFields` API to `SearchIndexClient` and `SearchIndexAsyncClient` to aid in creating `SearchField`s from the passed `Class`. @@ -32,6 +46,7 @@ - Removed `implementation` classes from APIs. ## 1.0.0-beta.4 (2020-06-09) + - Split `SearchServiceClient` into two clients `SearchIndexClient`, `SearchIndexerClient`. - Split `SearchServiceAsyncClient` into two clients `SearchIndexAsyncClient`, `SearchIndexerAsyncClient`. - Added `SearchIndexClientBuilder` to build sync client `SearchIndexClient` and async client `SearchIndexAsyncClient`. @@ -39,9 +54,9 @@ - Removed `SearchServiceClientBuilder`. - Renamed `SearchIndexClient` to `SearchClient` and `SearchIndexAsyncClient` to `SearchAsyncClient`. - Put all models used `SearchIndexClient` and `SearchIndexerClient` (same for async clients) under `com.azure.search.documents.indexes`. -- Removed `SearchIndexerDataSource` to `SearchIndexerDataSourceConnection`, +- Removed `SearchIndexerDataSource` to `SearchIndexerDataSourceConnection`. - Renamed methods on `SearchIndexerClient` and `SearchIndexerAsyncClient` idiomatically matching "DataSource" to "DataSourceConnection". -- Removed `DataSourceCredential` and `AzureActiveDirectoryApplicationCredentials`, +- Removed `DataSourceCredential` and `AzureActiveDirectoryApplicationCredentials` and uplifted the properties to `SearchIndexerDataSourceConnection` and `SearchResourceEncryptionKey` respectively. - Removed `select` parameter from list service resource APIs. - Added list names APIs for each search service resource. (e.g. `listSearchIndexNames`, `listSearchIndexerNames`, `listDataSourceNames`, `listSkillsetNames`, `listSynonymMapNames`) @@ -49,24 +64,25 @@ and uplifted the properties to `SearchIndexerDataSourceConnection` and `SearchRe `NGramTokenFilter`, and `PathHierarchyTokenizer`. - Renamed `Similarity` to `SimilarityAlgorithm`. - Renamed `Suggester` to `SearchSuggester`. -- Renamed fields `synonymMaps` to `synonymMapNames`, `analyzer` to `analyzerName`, -`searchAnalyzer` to `searchAnalyzerName` and `indexAnalyzer` to `indexAnalyzerName` +- Renamed fields `synonymMaps` to `synonymMapNames`, `analyzer` to `analyzerName`, +`searchAnalyzer` to `searchAnalyzerName` and `indexAnalyzer` to `indexAnalyzerName` in `SearchField`, `SearchableField`. - Renamed `SimpleField` to `SimpleFieldBuilder`, `SearchableField` to `SearchableFieldBuilder` and `ComplexField` to `ComplexFieldBuilder`. ## 1.0.0-beta.3 (2020-05-05) + - Replaced `isRetrievable` API with `isHidden`, parameter name changed from `retrievable` to `hidden`. -- Changed Azure Search service version from `2019-05-06` to `2019-05-06-Preview` +- Changed Azure Search service version from `2019-05-06` to `2019-05-06-Preview`. - Changed `createOrUpdate` and `delete` APIs in `SearchServiceClient` to use boolean `onlyIfUnchanged` instead of `MatchConditions`. - Updated reactor core to `3.3.5.RELEASE`. -- Added helper class `FieldBuilder` which converts a strongly-typed model class to `List`. +- Added helper class `FieldBuilder` which converts a strongly-typed model class to `List`. - Added annotations `FieldIgnore`, `SimpleFieldProperty`, and `SearchableFieldProperty` to define the `Field` on model properties. - Added fluent class `SimpleField`, `SearchableField`, and `ComplexField` to build `Field`. ## 1.0.0-beta.2 (2020-04-06) -Version 1.0.0-beta.2 is the consecutive beta version of 11.0.0-beta.1. The version is made because we renamed +Version 1.0.0-beta.2 is the consecutive beta version of 11.0.0-beta.1. The version is made because we renamed the search client library module name and namespace. - Renamed the azure-search module to azure-search-documents. @@ -77,15 +93,15 @@ the search client library module name and namespace. - Fixed a bug where the Date header wouldn't be updated with a new value on request retry. - Changed the field type of `CustomAnalyzer`. - Made `RangeFacetResult` and `ValueFacetResult` object strongly typed. -- Added helper function for IndexBatchException. +- Added helper function for IndexBatchException. - Added ScoringParameter class. - Refactored some boolean field getter. - Made `IndexDocumentsBatch` APIs plurality. ## 11.0.0-beta.1 (2020-03-10) -Version 11.0.0-beta.1 is a preview of our efforts in creating a client library that is developer-friendly, idiomatic -to the Java ecosystem, and as consistent across different languages and platforms as possible. The principles that guide +Version 11.0.0-beta.1 is a preview of our efforts in creating a client library that is developer-friendly, idiomatic +to the Java ecosystem, and as consistent across different languages and platforms as possible. The principles that guide our efforts can be found in the [Azure SDK Design Guidelines for Java](https://azure.github.io/azure-sdk/java_introduction.html). - Initial release. Please see the README and wiki for information on the new design. diff --git a/sdk/search/azure-search-documents/README.md b/sdk/search/azure-search-documents/README.md index ae77d3aa62c0b..62f9bdd5ca98d 100644 --- a/sdk/search/azure-search-documents/README.md +++ b/sdk/search/azure-search-documents/README.md @@ -1,16 +1,17 @@ # Azure Cognitive Search client library for Java -This is the Java client library for [Azure Cognitive Search](https://docs.microsoft.com/azure/search/). -Azure Cognitive Search service is a search-as-a-service cloud solution that gives developers APIs and tools for adding + +This is the Java client library for [Azure Cognitive Search](https://docs.microsoft.com/azure/search/). +Azure Cognitive Search service is a search-as-a-service cloud solution that gives developers APIs and tools for adding a rich search experience over private, heterogeneous content in web, mobile, and enterprise applications. The Azure Cognitive Search service is well suited for the following application scenarios: -* Consolidate varied content types into a single searchable index. To populate an index, you can push JSON documents +* Consolidate varied content types into a single searchable index. To populate an index, you can push JSON documents that contain your content, or if your data is already in Azure, create an indexer to pull in data automatically. -* Attach skillsets to an indexer to create searchable content from images and large text documents. A skillset leverages -AI from Cognitive Services for built-in OCR, entity recognition, key phrase extraction, language detection, text -translation, and sentiment analysis. You can also add custom skills to integrate external processing of your content +* Attach skillsets to an indexer to create searchable content from images and large text documents. A skillset leverages +AI from Cognitive Services for built-in OCR, entity recognition, key phrase extraction, language detection, text +translation, and sentiment analysis. You can also add custom skills to integrate external processing of your content during data ingestion. * In a search client application, implement query logic and user experiences similar to commercial web search engines. @@ -37,58 +38,59 @@ Use the Azure Cognitive Search client library to: com.azure azure-search-documents - 11.1.0-beta.1 + 11.1.0 ``` [//]: # ({x-version-update-end}) ### Prerequisites -- [Java Development Kit (JDK) with version 8 or above][jdk] -- [Azure subscription][azure_subscription] -- [Azure Cognitive Search service][search] -- To create a new search service, you can use the [Azure portal][create_search_service_docs], +* [Java Development Kit (JDK) with version 8 or above][jdk] +* [Azure subscription][azure_subscription] +* [Azure Cognitive Search service][search] +* To create a new search service, you can use the [Azure portal][create_search_service_docs], [Azure PowerShell][create_search_service_ps], or the [Azure CLI][create_search_service_cli]. Here's an example using the Azure CLI to create a free instance for getting started: -``` +```bash az search service create --name --resource-group --sku free --location westus ``` -- See [choosing a pricing tier](https://docs.microsoft.com/azure/search/search-sku-tier) - for more information about available options. - +See [choosing a pricing tier](https://docs.microsoft.com/azure/search/search-sku-tier) for more information about available options. + ### Authenticate the client -In order to interact with the Azure Cognitive Search service you'll need to create an instance of the Search Client class. -To make this possible you will need, +In order to interact with the Azure Cognitive Search service you'll need to create an instance of the Search Client class. +To make this possible you will need, + 1. [URL endpoint](https://docs.microsoft.com/azure/search/search-create-service-portal#get-a-key-and-url-endpoint) -1. All requests to a search service need an api-key that was generated specifically +1. [API key](https://docs.microsoft.com/azure/search/search-create-service-portal#get-a-key-and-url-endpoint) + for your service. [The api-key is the sole mechanism for authenticating access to your search service endpoint.](https://docs.microsoft.com/azure/search/search-security-api-keys) You can obtain your api-key from the [Azure portal](https://portal.azure.com/) or via the Azure CLI: -``` +```bash az search admin-key show --service-name --resource-group ``` **Note:** -1. The example Azure CLI snippet above retrieves an admin key. This allows for easier access when exploring APIs, + +* The example Azure CLI snippet above retrieves an admin key. This allows for easier access when exploring APIs, but it should be managed carefully. -1. There are two types of keys used to access your search service: **admin** *(read-write)* and **query** *(read-only)* +* There are two types of keys used to access your search service: **admin** *(read-write)* and **query** *(read-only)* keys. Restricting access and operations in client apps is essential to safeguarding the search assets on your service. Always use a query key rather than an admin key for any query originating from a client app. - The SDK provides three clients. -1. `SearchIndexClient` for CRUD operations on indexes and synonym maps. -1. `SearchIndexerClient` for CRUD operations on indexers, date sources, and skillsets. -1. `SearchClient` for all document operations. +* `SearchIndexClient` for CRUD operations on indexes and synonym maps. +* `SearchIndexerClient` for CRUD operations on indexers, date sources, and skillsets. +* `SearchClient` for all document operations. #### Create a SearchIndexClient -To create a `SearchIndexClient/SearchIndexAsyncClient`, you will need the values of the Azure Cognitive Search service +To create a `SearchIndexClient/SearchIndexAsyncClient`, you will need the values of the Azure Cognitive Search service URL endpoint and admin key. @@ -111,7 +113,7 @@ SearchIndexAsyncClient searchIndexAsyncClient = new SearchIndexClientBuilder() #### Create a SearchIndexerClient -To create a `SearchIndexerClient/SearchIndexerAsyncClient`, you will need the values of the Azure Cognitive Search service +To create a `SearchIndexerClient/SearchIndexerAsyncClient`, you will need the values of the Azure Cognitive Search service URL endpoint and admin key. @@ -134,7 +136,7 @@ SearchIndexerAsyncClient searchIndexerAsyncClient = new SearchIndexerClientBuild #### Create a SearchClient -Once you have the values of the Azure Cognitive Search service URL endpoint and +Once you have the values of the Azure Cognitive Search service URL endpoint and admin key, you can create the `SearchClient/SearchAsyncClient` with an existing index name: @@ -159,7 +161,7 @@ SearchAsyncClient searchAsyncClient = new SearchClientBuilder() ### Send your first search query -To get running immediately, we're going to connect to a well-known sandbox Search service provided by Microsoft. This +To get running immediately, we're going to connect to a well-known sandbox Search service provided by Microsoft. This means you do not need an Azure subscription or Azure Cognitive Search service to try out this query. @@ -194,8 +196,8 @@ for (SearchResult searchResult: searchResultsIterable) { ## Key concepts -An Azure Cognitive Search service contains one or more indexes that provide persistent storage of searchable data in -the form of JSON documents. _(If you're new to search, you can make a very rough analogy between indexes and database +An Azure Cognitive Search service contains one or more indexes that provide persistent storage of searchable data in +the form of JSON documents. _(If you're new to search, you can make a very rough analogy between indexes and database tables.)_ The `azure-search-documents` client library exposes operations on these resources through two main client types. * `SearchClient` helps with: @@ -220,6 +222,7 @@ tables.)_ The `azure-search-documents` client library exposes operations on thes * [Define AI powered Skillsets to transform and enrich your data](https://docs.microsoft.com/rest/api/searchservice/skillset-operations) ## Examples + The following examples all use a simple [Hotel data set](https://docs.microsoft.com/samples/azure-samples/azure-search-sample-data/azure-search-sample-data/) that you can [import into your own index from the Azure portal.](https://docs.microsoft.com/azure/search/search-get-started-portal#step-1---start-the-import-data-wizard-and-create-a-data-source) These are just a few of the basics - please [check out our Samples][samples_readme] for much more. @@ -241,7 +244,7 @@ Let's explore them with a search for a "luxury" hotel. #### Use `SearchDocument` like a dictionary for search results -`SearchDocument` is the default type returned from queries when you don't provide your own. Here we perform the search, +`SearchDocument` is the default type returned from queries when you don't provide your own. Here we perform the search, enumerate over the results, and extract data using `SearchDocument`'s dictionary indexer. @@ -307,7 +310,7 @@ The `SearchOptions` provide powerful control over the behavior of our queries. Let's search for the top 5 luxury hotels with a good rating. -```java +```java int stars = 4; SearchOptions options = new SearchOptions() .setFilter(String.format("rating ge %s", stars)) @@ -319,12 +322,12 @@ SearchPagedIterable searchResultsIterable = searchClient.search("luxury", option ### Creating an index -You can use the [`SearchIndexClient`](#Create-a-SearchIndexClient) to create a search index. Indexes can also define +You can use the [`SearchIndexClient`](#Create-a-SearchIndexClient) to create a search index. Indexes can also define suggesters, lexical analyzers, and more. There are multiple ways of preparing search fields for a search index. For basic needs, we provide a static helper method -`buildSearchFields` in `SearchIndexClient` and `SearchIndexAsyncClient`, which can convert Java POJO class into -`List`. There are three annotations `SimpleFieldProperty`, `SearchFieldProperty` and `FieldBuilderIgnore` +`buildSearchFields` in `SearchIndexClient` and `SearchIndexAsyncClient`, which can convert Java POJO class into +`List`. There are three annotations `SimpleFieldProperty`, `SearchFieldProperty` and `FieldBuilderIgnore` to configure the field of model class. @@ -391,12 +394,12 @@ searchIndexClient.createIndex(index); ### Retrieving a specific document from your index -In addition to querying for documents using keywords and optional filters, you can retrieve a specific document from +In addition to querying for documents using keywords and optional filters, you can retrieve a specific document from your index if you already know the key. You could get the key from a query, for example, and want to show more information about it or navigate your customer to that document. -```java +```java Hotel hotel = searchClient.getDocument("1", Hotel.class); System.out.printf("This is hotelId %s, and this is hotel name %s.%n", hotel.getId(), hotel.getName()); ``` @@ -415,14 +418,13 @@ batch.addMergeActions(Collections.singletonList(new Hotel().setId("12").setName( searchClient.indexDocuments(batch); ``` -The request will throw `IndexBatchException` by default if any of the individual actions fail, and you can use -`findFailedActionsToRetry` to retry on failed documents. There's also a `throwOnAnyError` option, and you can set it +The request will throw `IndexBatchException` by default if any of the individual actions fail, and you can use +`findFailedActionsToRetry` to retry on failed documents. There's also a `throwOnAnyError` option, and you can set it to `false` to get a successful response with an `IndexDocumentsResult` for inspection. - ### Async APIs -The examples so far have been using synchronous APIs, but we provide full support for async APIs as well. You'll need +The examples so far have been using synchronous APIs, but we provide full support for async APIs as well. You'll need to use [SearchAsyncClient](#Create-a-SearchClient). @@ -438,13 +440,13 @@ searchAsyncClient.search("luxury") ### General -When you interact with Azure Cognitive Search using this Java client library, errors returned by the service correspond -to the same HTTP status codes returned for [REST API][rest_api] requests. For example, the service will return a `404` +When you interact with Azure Cognitive Search using this Java client library, errors returned by the service correspond +to the same HTTP status codes returned for [REST API][rest_api] requests. For example, the service will return a `404` error if you try to retrieve a document that doesn't exist in your index. ### Handling Search Error Response -Any Search API operation that fails will throw an [`HttpResponseException`][HttpResponseException] with helpful +Any Search API operation that fails will throw an [`HttpResponseException`][HttpResponseException] with helpful [`Status codes`][status_codes]. Many of these errors are recoverable. @@ -460,13 +462,13 @@ try { } ``` -You can also easily [enable console logging][logging] if you want to dig deeper into the requests you're making against +You can also easily [enable console logging][logging] if you want to dig deeper into the requests you're making against the service. ### Enabling Logging -Azure SDKs for Java provide a consistent logging story to help aid in troubleshooting application errors and expedite -their resolution. The logs produced will capture the flow of an application before reaching the terminal state to help +Azure SDKs for Java provide a consistent logging story to help aid in troubleshooting application errors and expedite +their resolution. The logs produced will capture the flow of an application before reaching the terminal state to help locate the root issue. View the [logging][logging] wiki for guidance about enabling logging. ### Default HTTP Client @@ -476,21 +478,21 @@ provides more information on configuring or changing the HTTP client. ## Next steps -- Samples are explained in detail [here][samples_readme]. -- Watch a [demo or deep dive video](https://azure.microsoft.com/resources/videos/index/?services=search) -- Read more about the [Azure Cognitive Search service](https://docs.microsoft.com/azure/search/search-what-is-azure-search) +* Samples are explained in detail [here][samples_readme]. +* Watch a [demo or deep dive video](https://azure.microsoft.com/resources/videos/index/?services=search) +* Read more about the [Azure Cognitive Search service](https://docs.microsoft.com/azure/search/search-what-is-azure-search) ## Contributing -This project welcomes contributions and suggestions. Most contributions require you to agree to a -[Contributor License Agreement (CLA)][cla] declaring that you have the right to, and actually do, grant us the rights +This project welcomes contributions and suggestions. Most contributions require you to agree to a +[Contributor License Agreement (CLA)][cla] declaring that you have the right to, and actually do, grant us the rights to use your contribution. -When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate -the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate +the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. -This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments. @@ -501,9 +503,9 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [azure_subscription]: https://azure.microsoft.com/free [maven]: https://maven.apache.org/ [package]: https://search.maven.org/artifact/com.azure/azure-search-documents -[samples]: src/samples/java/com/azure/search -[samples_readme]: src/samples/README.md -[source_code]: src +[samples]: https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents +[samples_readme]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/search/azure-search-documents/src/samples/README.md +[source_code]: https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/search/azure-search-documents/src [logging]: https://github.com/Azure/azure-sdk-for-java/wiki/Logging-with-Azure-SDK [cla]: https://cla.microsoft.com [coc]: https://opensource.microsoft.com/codeofconduct/ diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/util/FieldBuilder.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/util/FieldBuilder.java index ec93b9f112b56..5276492ac9a30 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/util/FieldBuilder.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/util/FieldBuilder.java @@ -8,8 +8,8 @@ import com.azure.core.util.serializer.MemberNameConverterProviders; import com.azure.core.util.serializer.ObjectSerializer; import com.azure.search.documents.indexes.FieldBuilderIgnore; -import com.azure.search.documents.indexes.SearchableFieldProperty; -import com.azure.search.documents.indexes.SimpleFieldProperty; +import com.azure.search.documents.indexes.SearchableField; +import com.azure.search.documents.indexes.SimpleField; import com.azure.search.documents.indexes.models.FieldBuilderOptions; import com.azure.search.documents.indexes.models.LexicalAnalyzerName; import com.azure.search.documents.indexes.models.SearchField; @@ -248,22 +248,22 @@ private static SearchField convertToBasicSearchField(String fieldName, Type type } private static SearchField enrichWithAnnotation(SearchField searchField, Member member) { - SimpleFieldProperty simpleFieldProperty = getDeclaredAnnotation(member, SimpleFieldProperty.class); - SearchableFieldProperty searchableFieldProperty = getDeclaredAnnotation(member, SearchableFieldProperty.class); + SimpleField simpleField = getDeclaredAnnotation(member, SimpleField.class); + SearchableField searchableField = getDeclaredAnnotation(member, SearchableField.class); - if (simpleFieldProperty != null && searchableFieldProperty != null) { + if (simpleField != null && searchableField != null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("@SimpleFieldProperty and @SearchableFieldProperty cannot be present simultaneously " + "for %s", member.getName()))); } - if (simpleFieldProperty != null) { + if (simpleField != null) { searchField.setSearchable(false) - .setSortable(simpleFieldProperty.isSortable()) - .setFilterable(simpleFieldProperty.isFilterable()) - .setFacetable(simpleFieldProperty.isFacetable()) - .setKey(simpleFieldProperty.isKey()) - .setHidden(simpleFieldProperty.isHidden()); - } else if (searchableFieldProperty != null) { + .setSortable(simpleField.isSortable()) + .setFilterable(simpleField.isFilterable()) + .setFacetable(simpleField.isFacetable()) + .setKey(simpleField.isKey()) + .setHidden(simpleField.isHidden()); + } else if (searchableField != null) { if (!searchField.getType().equals(SearchFieldDataType.STRING) && !searchField.getType().equals(SearchFieldDataType.collection(SearchFieldDataType.STRING))) { throw LOGGER.logExceptionAsError(new RuntimeException(String.format("SearchFieldProperty can only" @@ -272,32 +272,32 @@ private static SearchField enrichWithAnnotation(SearchField searchField, Member } searchField.setSearchable(true) - .setSortable(searchableFieldProperty.isSortable()) - .setFilterable(searchableFieldProperty.isFilterable()) - .setFacetable(searchableFieldProperty.isFacetable()) - .setKey(searchableFieldProperty.isKey()) - .setHidden(searchableFieldProperty.isHidden()); - String analyzer = searchableFieldProperty.analyzerName(); - String searchAnalyzer = searchableFieldProperty.searchAnalyzerName(); - String indexAnalyzer = searchableFieldProperty.indexAnalyzerName(); + .setSortable(searchableField.isSortable()) + .setFilterable(searchableField.isFilterable()) + .setFacetable(searchableField.isFacetable()) + .setKey(searchableField.isKey()) + .setHidden(searchableField.isHidden()); + String analyzer = searchableField.analyzerName(); + String searchAnalyzer = searchableField.searchAnalyzerName(); + String indexAnalyzer = searchableField.indexAnalyzerName(); if (!analyzer.isEmpty() && (!searchAnalyzer.isEmpty() || !indexAnalyzer.isEmpty())) { throw LOGGER.logExceptionAsError(new RuntimeException( "Please specify either analyzer or both searchAnalyzer and indexAnalyzer.")); } - if (!searchableFieldProperty.analyzerName().isEmpty()) { + if (!searchableField.analyzerName().isEmpty()) { searchField.setAnalyzerName(LexicalAnalyzerName.fromString( - searchableFieldProperty.analyzerName())); + searchableField.analyzerName())); } - if (!searchableFieldProperty.searchAnalyzerName().isEmpty()) { + if (!searchableField.searchAnalyzerName().isEmpty()) { searchField.setAnalyzerName(LexicalAnalyzerName.fromString( - searchableFieldProperty.searchAnalyzerName())); + searchableField.searchAnalyzerName())); } - if (!searchableFieldProperty.indexAnalyzerName().isEmpty()) { + if (!searchableField.indexAnalyzerName().isEmpty()) { searchField.setAnalyzerName(LexicalAnalyzerName.fromString( - searchableFieldProperty.indexAnalyzerName())); + searchableField.indexAnalyzerName())); } - if (searchableFieldProperty.synonymMapNames().length != 0) { - List synonymMaps = Arrays.stream(searchableFieldProperty.synonymMapNames()) + if (searchableField.synonymMapNames().length != 0) { + List synonymMaps = Arrays.stream(searchableField.synonymMapNames()) .filter(synonym -> !synonym.trim().isEmpty()).collect(Collectors.toList()); searchField.setSynonymMapNames(synonymMaps); } diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchableField.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchableField.java new file mode 100644 index 0000000000000..cec17d813d595 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchableField.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.search.documents.indexes; + +import com.azure.search.documents.indexes.models.FieldBuilderOptions; +import com.azure.search.documents.indexes.models.LexicalAnalyzerName; +import com.azure.search.documents.indexes.models.SearchField; +import com.azure.search.documents.indexes.models.SynonymMap; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * An annotation that directs {@link SearchIndexAsyncClient#buildSearchFields(Class, FieldBuilderOptions)} to turn the + * field or method into a searchable {@link SearchField field}. + */ +@Target({ElementType.FIELD, ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface SearchableField { + /** + * Indicates if the field or method should generate as a key {@link SearchField field}. + * + * @return A flag indicating if the field or method should generate as a key {@link SearchField field}. + */ + boolean isKey() default false; + + /** + * Indicates if the field or method should generate as a hidden {@link SearchField field}. + * + * @return A flag indicating if the field or method should generate as a hidden {@link SearchField field}. + */ + boolean isHidden() default false; + + /** + * Indicates if the field or method should generate as a facetable {@link SearchField field}. + * + * @return A flag indicating if the field or method should generate as a facetable {@link SearchField field}. + */ + boolean isFacetable() default false; + + /** + * Indicates if the field or method should generate as a sortable {@link SearchField field}. + * + * @return A flag indicating if the field or method should generate as a sortable {@link SearchField field}. + */ + boolean isSortable() default false; + + /** + * Indicates if the field or method should generate as a filterable {@link SearchField field}. + * + * @return A flag indicating if the field or method should generate as a filterable {@link SearchField field}. + */ + boolean isFilterable() default false; + + /** + * A {@link LexicalAnalyzerName} to associate as the search and index analyzer for the {@link SearchField field}. + * + * @return The {@link LexicalAnalyzerName} that will be associated as the search and index analyzer for the {@link + * SearchField field}. + */ + String analyzerName() default ""; + + /** + * A {@link LexicalAnalyzerName} to associate as the search analyzer for the {@link SearchField field}. + * + * @return The {@link LexicalAnalyzerName} that will be associated as the search analyzer for the {@link SearchField + * field}. + */ + String searchAnalyzerName() default ""; + + /** + * A {@link LexicalAnalyzerName} to associate as the index analyzer for the {@link SearchField field}. + * + * @return The {@link LexicalAnalyzerName} that will be associated as the index analyzer for the {@link SearchField + * field}. + */ + String indexAnalyzerName() default ""; + + /** + * A list of {@link SynonymMap} names to be associated with the {@link SearchField field}. + *

+ * Assigning a synonym map to a field ensures that query terms targeting that field are expanded at query-time using + * the rules in the synonym map. The synonym map attribute may be changed on existing fields. + *

+ * Currently, only one synonym map per field is supported. + * + * @return The {@link SynonymMap} names that will be associated with the {@link SearchField field}. + */ + String[] synonymMapNames() default {}; +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchableFieldProperty.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchableFieldProperty.java deleted file mode 100644 index 8f37ec1018de9..0000000000000 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchableFieldProperty.java +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.search.documents.indexes; - -import com.azure.search.documents.indexes.models.LexicalAnalyzerName; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * The annotation is to indicate whether the field is a searchable field. The boolean field of isSearchable - * defaults to true if use the annotation. - */ -@Target({ElementType.FIELD, ElementType.METHOD}) -@Retention(RetentionPolicy.RUNTIME) -public @interface SearchableFieldProperty { - /** - * Optional arguments defines whether the field is a key field or not. - * - * @return True if it is the key of SearchField, and false by default for non-key field. - */ - boolean isKey() default false; - - /** - * Optional arguments defines whether the field is hidden or not. - * - * @return True if it is not retrievable, and false by default for retrievable field. - */ - boolean isHidden() default false; - - /** - * Optional arguments defines whether the field is facetable or not. - * - * @return True if it is facetable, and false by default for non-facetable field. - */ - boolean isFacetable() default false; - - /** - * Optional arguments defines whether the field is sortable or not. - * - * @return True if it is sortable, and false by default for non-sortable field. - */ - boolean isSortable() default false; - - /** - * Optional arguments defines whether the field is filterable or not. - * - * @return True if it is filterable, and false by default for non-filterable field. - */ - boolean isFilterable() default false; - - /** - * Optional arguments defines the name of the analyzer used for the field. - * - * @return {@link LexicalAnalyzerName} String value. Or default to "null" String type. - */ - String analyzerName() default ""; - - /** - * Optional arguments defines the name of the search analyzer used for the field. - * - * @return {@link LexicalAnalyzerName} String value. Or default to an empty String. - */ - String searchAnalyzerName() default ""; - - /** - * Optional arguments defines the name of the analyzer used for the field. - * - * @return {@link LexicalAnalyzerName} String value. Or default to an empty String. - */ - String indexAnalyzerName() default ""; - - /** - * Optional arguments defines the array of synonymMaps used for the field. - * This option can be used only with searchable fields. Currently only one - * synonym map per field is supported. Assigning a synonym map to a field - * ensures that query terms targeting that field are expanded at query-time - * using the rules in the synonym map. This attribute can be changed on - * existing fields. - * - * @return An array of synonym map values. Or default to empty string array. - */ - String[] synonymMapNames() default {}; -} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SimpleField.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SimpleField.java new file mode 100644 index 0000000000000..98d4609465747 --- /dev/null +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SimpleField.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.search.documents.indexes; + +import com.azure.search.documents.indexes.models.FieldBuilderOptions; +import com.azure.search.documents.indexes.models.SearchField; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * An annotation that directs {@link SearchIndexAsyncClient#buildSearchFields(Class, FieldBuilderOptions)} to turn the + * field or method into a non-searchable {@link SearchField field}. + */ +@Target({ElementType.FIELD, ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface SimpleField { + /** + * Indicates if the field or method should generate as a key {@link SearchField field}. + * + * @return A flag indicating if the field or method should generate as a key {@link SearchField field}. + */ + boolean isKey() default false; + + /** + * Indicates if the field or method should generate as a hidden {@link SearchField field}. + * + * @return A flag indicating if the field or method should generate as a hidden {@link SearchField field}. + */ + boolean isHidden() default false; + + /** + * Indicates if the field or method should generate as a facetable {@link SearchField field}. + * + * @return A flag indicating if the field or method should generate as a facetable {@link SearchField field}. + */ + boolean isFacetable() default false; + + /** + * Indicates if the field or method should generate as a sortable {@link SearchField field}. + * + * @return A flag indicating if the field or method should generate as a sortable {@link SearchField field}. + */ + boolean isSortable() default false; + + /** + * Indicates if the field or method should generate as a filterable {@link SearchField field}. + * + * @return A flag indicating if the field or method should generate as a filterable {@link SearchField field}. + */ + boolean isFilterable() default false; +} diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SimpleFieldProperty.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SimpleFieldProperty.java deleted file mode 100644 index f8a9acd34e30e..0000000000000 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SimpleFieldProperty.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.search.documents.indexes; - -import com.azure.search.documents.indexes.models.SearchField; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * The annotation is to indicate whether the field is a simple field. This annotation can only set boolean field of - * {@link SearchField}. {@code isSearchable} will set to {@code false}. - */ -@Target({ElementType.FIELD, ElementType.METHOD}) -@Retention(RetentionPolicy.RUNTIME) -public @interface SimpleFieldProperty { - /** - * Optional arguments defines whether the field is a key field or not. - * - * @return True if it is the key of SearchField, and false by default for non-key field. - */ - boolean isKey() default false; - - /** - * Optional arguments defines whether the field is hidden or not. - * - * @return True if it is not retrievable, and false by default for retrievable field. - */ - boolean isHidden() default false; - - /** - * Optional arguments defines whether the field is facetable or not. - * - * @return True if it is facetable, and false by default for non-facetable field. - */ - boolean isFacetable() default false; - - /** - * Optional arguments defines whether the field is sortable or not. - * - * @return True if it is sortable, and false by default for non-sortable field. - */ - boolean isSortable() default false; - - /** - * Optional arguments defines whether the field is filterable or not. - * - * @return True if it is filterable, and false by default for non-filterable field. - */ - boolean isFilterable() default false; -} diff --git a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/models/Hotel.java b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/models/Hotel.java index c4769aa7696ac..7aa1133e926cf 100644 --- a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/models/Hotel.java +++ b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/models/Hotel.java @@ -2,8 +2,8 @@ // Licensed under the MIT License. package com.azure.search.documents.models; -import com.azure.search.documents.indexes.SearchableFieldProperty; -import com.azure.search.documents.indexes.SimpleFieldProperty; +import com.azure.search.documents.indexes.SearchableField; +import com.azure.search.documents.indexes.SimpleField; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.ArrayList; @@ -19,7 +19,7 @@ public Hotel() { } @JsonProperty(value = "HotelId") - @SimpleFieldProperty(isKey = true) + @SimpleField(isKey = true) public String getHotelId() { return this.hotelId; } @@ -30,7 +30,7 @@ public Hotel setHotelId(String hotelId) { } @JsonProperty(value = "Tags") - @SearchableFieldProperty(isFilterable = true, analyzerName = "en.lucene") + @SearchableField(isFilterable = true, analyzerName = "en.lucene") public List getTags() { return this.tags; } diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/Foo.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/Foo.java index 076083b370781..a3978236379da 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/Foo.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/Foo.java @@ -2,10 +2,10 @@ // Licensed under the MIT License. package com.azure.search.documents.test.environment.models; -import com.azure.search.documents.indexes.SimpleFieldProperty; +import com.azure.search.documents.indexes.SimpleField; public class Foo { - @SimpleFieldProperty(isKey = true) + @SimpleField(isKey = true) private String intValue; private String stringValue; diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/Hotel.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/Hotel.java index 34ebb04ff2c9c..4f24eef9a1da6 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/Hotel.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/Hotel.java @@ -3,8 +3,8 @@ package com.azure.search.documents.test.environment.models; import com.azure.search.documents.indexes.FieldBuilderIgnore; -import com.azure.search.documents.indexes.SearchableFieldProperty; -import com.azure.search.documents.indexes.SimpleFieldProperty; +import com.azure.search.documents.indexes.SearchableField; +import com.azure.search.documents.indexes.SimpleField; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; @@ -14,15 +14,15 @@ @JsonIgnoreProperties(ignoreUnknown = true) public class Hotel { - @SimpleFieldProperty(isKey = true, isSortable = true) + @SimpleField(isKey = true, isSortable = true) @JsonProperty(value = "HotelId") private String hotelId; - @SearchableFieldProperty(isSortable = true, analyzerName = "en.lucene") + @SearchableField(isSortable = true, analyzerName = "en.lucene") @JsonProperty(value = "HotelName") private String hotelName; - @SimpleFieldProperty + @SimpleField @JsonProperty(value = "Description") private String description; @@ -30,11 +30,11 @@ public class Hotel { @JsonProperty(value = "Description_fr") private String descriptionFr; - @SimpleFieldProperty + @SimpleField @JsonProperty(value = "Category") private String category; - @SearchableFieldProperty + @SearchableField @JsonProperty(value = "Tags") private List tags; diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelAddress.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelAddress.java index 15a2874148e7c..9a830067808d2 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelAddress.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelAddress.java @@ -2,28 +2,28 @@ // Licensed under the MIT License. package com.azure.search.documents.test.environment.models; -import com.azure.search.documents.indexes.SearchableFieldProperty; -import com.azure.search.documents.indexes.SimpleFieldProperty; +import com.azure.search.documents.indexes.SearchableField; +import com.azure.search.documents.indexes.SimpleField; import com.fasterxml.jackson.annotation.JsonProperty; public class HotelAddress { - @SimpleFieldProperty(isFacetable = true) + @SimpleField(isFacetable = true) @JsonProperty(value = "StreetAddress") private String streetAddress; - @SearchableFieldProperty(isFilterable = true) + @SearchableField(isFilterable = true) @JsonProperty(value = "City") private String city; - @SearchableFieldProperty + @SearchableField @JsonProperty(value = "StateProvince") private String stateProvince; - @SearchableFieldProperty(synonymMapNames = {"fieldbuilder"}) + @SearchableField(synonymMapNames = {"fieldbuilder"}) @JsonProperty(value = "Country") private String country; - @SimpleFieldProperty + @SimpleField @JsonProperty(value = "PostalCode") private String postalCode; diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelAnalyzerException.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelAnalyzerException.java index 52b6dca0e717a..b80544ad7c15c 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelAnalyzerException.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelAnalyzerException.java @@ -3,7 +3,7 @@ package com.azure.search.documents.test.environment.models; -import com.azure.search.documents.indexes.SearchableFieldProperty; +import com.azure.search.documents.indexes.SearchableField; public class HotelAnalyzerException { private String tag; @@ -13,7 +13,7 @@ public class HotelAnalyzerException { * * @return The tag of hotel. */ - @SearchableFieldProperty(analyzerName = "en.microsoft", indexAnalyzerName = "whitespce") + @SearchableField(analyzerName = "en.microsoft", indexAnalyzerName = "whitespce") public String getTag() { return tag; } diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelRenameProperty.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelRenameProperty.java index cb3e139d29204..bb17db8d1695b 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelRenameProperty.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelRenameProperty.java @@ -3,8 +3,8 @@ package com.azure.search.documents.test.environment.models; -import com.azure.search.documents.indexes.SearchableFieldProperty; -import com.azure.search.documents.indexes.SimpleFieldProperty; +import com.azure.search.documents.indexes.SearchableField; +import com.azure.search.documents.indexes.SimpleField; import com.fasterxml.jackson.annotation.JsonProperty; public class HotelRenameProperty { @@ -12,7 +12,7 @@ public class HotelRenameProperty { private String hotelName; private String description; - @SimpleFieldProperty(isKey = true, isSortable = true) + @SimpleField(isKey = true, isSortable = true) @JsonProperty public String getHotelId() { return this.hotelId; @@ -23,7 +23,7 @@ public HotelRenameProperty setHotelId(String hotelId) { return this; } - @SearchableFieldProperty(isSortable = true, analyzerName = "en.lucene") + @SearchableField(isSortable = true, analyzerName = "en.lucene") @JsonProperty(value = "HotelName") public String getHotelName() { return this.hotelName; @@ -34,7 +34,7 @@ public HotelRenameProperty setHotelName(String hotelName) { return this; } - @SimpleFieldProperty + @SimpleField public String getDescription() { return this.description; } diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelSearchException.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelSearchException.java index 9f845f381af93..19da08dfd9fb7 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelSearchException.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelSearchException.java @@ -3,7 +3,7 @@ package com.azure.search.documents.test.environment.models; -import com.azure.search.documents.indexes.SearchableFieldProperty; +import com.azure.search.documents.indexes.SearchableField; /** * The data object model is to test exception case. @@ -16,7 +16,7 @@ public class HotelSearchException { * * @return Get hotel id */ - @SearchableFieldProperty + @SearchableField public int getHotelId() { return hotelId; } diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelSearchableExceptionOnList.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelSearchableExceptionOnList.java index 9abe73d60463c..fbda29d6519c9 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelSearchableExceptionOnList.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelSearchableExceptionOnList.java @@ -3,7 +3,7 @@ package com.azure.search.documents.test.environment.models; -import com.azure.search.documents.indexes.SearchableFieldProperty; +import com.azure.search.documents.indexes.SearchableField; import java.util.List; @@ -17,7 +17,7 @@ public class HotelSearchableExceptionOnList { * Gets passcode. * @return the passcode of hotel. */ - @SearchableFieldProperty + @SearchableField public List getPasscode() { return passcode; } diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelWithArray.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelWithArray.java index 1287cbcca1a0d..e789a5197fcfa 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelWithArray.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelWithArray.java @@ -4,19 +4,19 @@ package com.azure.search.documents.test.environment.models; import com.azure.core.util.CoreUtils; -import com.azure.search.documents.indexes.SearchableFieldProperty; -import com.azure.search.documents.indexes.SimpleFieldProperty; +import com.azure.search.documents.indexes.SearchableField; +import com.azure.search.documents.indexes.SimpleField; public class HotelWithArray { private String hotelId; private String[] tags; - @SimpleFieldProperty(isKey = true, isSortable = true) + @SimpleField(isKey = true, isSortable = true) public String getHotelId() { return hotelId; } - @SearchableFieldProperty + @SearchableField public String[] getTags() { return CoreUtils.clone(tags); } diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelWithEmptyInSynonymMaps.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelWithEmptyInSynonymMaps.java index 47714d33e1c14..488ba8b806d3e 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelWithEmptyInSynonymMaps.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/test/environment/models/HotelWithEmptyInSynonymMaps.java @@ -3,7 +3,7 @@ package com.azure.search.documents.test.environment.models; -import com.azure.search.documents.indexes.SearchableFieldProperty; +import com.azure.search.documents.indexes.SearchableField; import java.util.List; @@ -18,7 +18,7 @@ public class HotelWithEmptyInSynonymMaps { * * @return The tags of hotel. */ - @SearchableFieldProperty(synonymMapNames = {"asynonymMaps", "", " ", "maps"}) + @SearchableField(synonymMapNames = {"asynonymMaps", "", " ", "maps"}) public List getTags() { return tags; } diff --git a/sdk/search/azure-search-perf/src/main/java/com/azure/search/perf/core/Address.java b/sdk/search/azure-search-perf/src/main/java/com/azure/search/perf/core/Address.java index 2b3f0d696d40d..10150f803f289 100644 --- a/sdk/search/azure-search-perf/src/main/java/com/azure/search/perf/core/Address.java +++ b/sdk/search/azure-search-perf/src/main/java/com/azure/search/perf/core/Address.java @@ -3,7 +3,7 @@ package com.azure.search.perf.core; -import com.azure.search.documents.indexes.SearchableFieldProperty; +import com.azure.search.documents.indexes.SearchableField; import com.fasterxml.jackson.annotation.JsonProperty; /** @@ -11,22 +11,22 @@ */ public class Address { @JsonProperty("StreetAddress") - @SearchableFieldProperty + @SearchableField public String streetAddress; @JsonProperty("City") - @SearchableFieldProperty(isFilterable = true, isSortable = true, isFacetable = true) + @SearchableField(isFilterable = true, isSortable = true, isFacetable = true) public String city; @JsonProperty("StateProvince") - @SearchableFieldProperty(isFilterable = true, isSortable = true, isFacetable = true) + @SearchableField(isFilterable = true, isSortable = true, isFacetable = true) public String stateProvince; @JsonProperty("PostalCode") - @SearchableFieldProperty(isFilterable = true, isSortable = true, isFacetable = true) + @SearchableField(isFilterable = true, isSortable = true, isFacetable = true) public String postalCode; @JsonProperty("Country") - @SearchableFieldProperty(isFilterable = true, isSortable = true, isFacetable = true) + @SearchableField(isFilterable = true, isSortable = true, isFacetable = true) public String country; } diff --git a/sdk/search/azure-search-perf/src/main/java/com/azure/search/perf/core/Hotel.java b/sdk/search/azure-search-perf/src/main/java/com/azure/search/perf/core/Hotel.java index 8250958ce0d14..60e354aa5f2e9 100644 --- a/sdk/search/azure-search-perf/src/main/java/com/azure/search/perf/core/Hotel.java +++ b/sdk/search/azure-search-perf/src/main/java/com/azure/search/perf/core/Hotel.java @@ -3,8 +3,8 @@ package com.azure.search.perf.core; -import com.azure.search.documents.indexes.SearchableFieldProperty; -import com.azure.search.documents.indexes.SimpleFieldProperty; +import com.azure.search.documents.indexes.SearchableField; +import com.azure.search.documents.indexes.SimpleField; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; @@ -14,39 +14,39 @@ */ public class Hotel { @JsonProperty("HotelId") - @SimpleFieldProperty(isKey = true) + @SimpleField(isKey = true) public String hotelId; @JsonProperty("HotelName") - @SearchableFieldProperty(isSortable = true) + @SearchableField(isSortable = true) public String hotelName; @JsonProperty("Description") - @SearchableFieldProperty(analyzerName = "en.microsoft") + @SearchableField(analyzerName = "en.microsoft") public String description; @JsonProperty("DescriptionFr") - @SearchableFieldProperty(analyzerName = "fr.lucene") + @SearchableField(analyzerName = "fr.lucene") public String descriptionFr; @JsonProperty("Category") - @SearchableFieldProperty(isFilterable = true, isSortable = true, isFacetable = true) + @SearchableField(isFilterable = true, isSortable = true, isFacetable = true) public String category; @JsonProperty("Tags") - @SearchableFieldProperty(isFilterable = true, isFacetable = true) + @SearchableField(isFilterable = true, isFacetable = true) public String[] tags; @JsonProperty("ParkingIncluded") - @SimpleFieldProperty(isFilterable = true, isSortable = true, isFacetable = true) + @SimpleField(isFilterable = true, isSortable = true, isFacetable = true) public Boolean parkingIncluded; @JsonProperty("LastRenovationDate") - @SimpleFieldProperty(isFilterable = true, isSortable = true, isFacetable = true) + @SimpleField(isFilterable = true, isSortable = true, isFacetable = true) public OffsetDateTime lastRenovationDate; @JsonProperty("Rating") - @SimpleFieldProperty(isFilterable = true, isSortable = true, isFacetable = true) + @SimpleField(isFilterable = true, isSortable = true, isFacetable = true) public Double rating; @JsonProperty("Address") From 603911cf9f4258cf70153317b453c14ac3319724 Mon Sep 17 00:00:00 2001 From: alzimmermsft <48699787+alzimmermsft@users.noreply.github.com> Date: Wed, 9 Sep 2020 12:45:40 -0700 Subject: [PATCH 2/2] Update version for release --- eng/jacoco-test-coverage/pom.xml | 2 +- eng/versioning/version_client.txt | 2 +- sdk/search/azure-search-documents/pom.xml | 2 +- sdk/search/azure-search-perf/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/jacoco-test-coverage/pom.xml b/eng/jacoco-test-coverage/pom.xml index fb2f443f5329a..e02fce5ce87f8 100644 --- a/eng/jacoco-test-coverage/pom.xml +++ b/eng/jacoco-test-coverage/pom.xml @@ -164,7 +164,7 @@ com.azure azure-search-documents - 11.1.0-beta.2 + 11.1.0 com.azure diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 3a489cb99306e..7a3b074e5f05b 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -35,7 +35,7 @@ com.azure:azure-messaging-eventgrid;2.0.0-beta.1;2.0.0-beta.1 com.azure:azure-messaging-eventhubs;5.1.2;5.2.0-beta.3 com.azure:azure-messaging-eventhubs-checkpointstore-blob;1.1.2;1.2.0-beta.3 com.azure:azure-messaging-servicebus;7.0.0-beta.5;7.0.0-beta.6 -com.azure:azure-search-documents;11.0.0;11.1.0-beta.2 +com.azure:azure-search-documents;11.0.0;11.1.0 com.azure:azure-search-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-security-keyvault-administration;4.0.0-beta.1;4.0.0-beta.1 com.azure:azure-security-keyvault-certificates;4.1.0;4.2.0-beta.1 diff --git a/sdk/search/azure-search-documents/pom.xml b/sdk/search/azure-search-documents/pom.xml index b73b14d1f8221..123f9da4134a7 100644 --- a/sdk/search/azure-search-documents/pom.xml +++ b/sdk/search/azure-search-documents/pom.xml @@ -16,7 +16,7 @@ com.azure azure-search-documents - 11.1.0-beta.2 + 11.1.0 jar diff --git a/sdk/search/azure-search-perf/pom.xml b/sdk/search/azure-search-perf/pom.xml index b4977a8f70c98..d7eebbfa19d78 100644 --- a/sdk/search/azure-search-perf/pom.xml +++ b/sdk/search/azure-search-perf/pom.xml @@ -32,7 +32,7 @@ com.azure azure-search-documents - 11.1.0-beta.2 + 11.1.0