diff --git a/sdk/search/azure-search-documents/README.md b/sdk/search/azure-search-documents/README.md index 969bb4c92600..5750b4c0a2d5 100644 --- a/sdk/search/azure-search-documents/README.md +++ b/sdk/search/azure-search-documents/README.md @@ -90,7 +90,7 @@ to get started exploring APIs, but it should be managed carefully.* To instantiate the `SearchClient`, you'll need the **endpoint**, **API key** and **index name**: - + ```python from azure.core.credentials import AzureKeyCredential @@ -170,7 +170,7 @@ To learn more about semantic ranking, you can refer to the [documentation](https **Vector search** is an information retrieval technique that uses numeric representations of searchable documents and query strings. By searching for numeric representations of content that are most similar to the numeric query, vector search can find relevant matches, even if the exact terms of the query are not present in the index. Moreover, vector search can be applied to various types of content, including images and videos and translated text, not just same-language text. -To learn how to index vector fields and perform vector search, you can refer to the [sample](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_vector_search.py). This sample provides detailed guidance on indexing vector fields and demonstrates how to perform vector search. +To learn how to index vector fields and perform vector search, you can refer to the [sample](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_query_vector.py). This sample provides detailed guidance on indexing vector fields and demonstrates how to perform vector search. Additionally, for more comprehensive information about vector search, including its concepts and usage, you can refer to the [documentation](https://learn.microsoft.com/azure/search/vector-search-overview). The documentation provides in-depth explanations and guidance on leveraging the power of vector search in Azure AI Search. @@ -231,30 +231,49 @@ You can use the `SearchIndexClient` to create a search index. Fields can be defined using convenient `SimpleField`, `SearchableField`, or `ComplexField` models. Indexes can also define suggesters, lexical analyzers, and more. - + ```python -client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) -name = "hotels" +from azure.core.credentials import AzureKeyCredential +from azure.search.documents.indexes import SearchIndexClient +from azure.search.documents.indexes.models import ( + ComplexField, + CorsOptions, + SearchIndex, + ScoringProfile, + SearchFieldDataType, + SimpleField, + SearchableField, +) + +index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) fields = [ - SimpleField(name="hotelId", type=SearchFieldDataType.String, key=True), - SimpleField(name="hotelName", type=SearchFieldDataType.String, searchable=True), - SimpleField(name="baseRate", type=SearchFieldDataType.Double), - SearchableField(name="description", type=SearchFieldDataType.String, collection=True), + SimpleField(name="HotelId", type=SearchFieldDataType.String, key=True), + SimpleField(name="HotelName", type=SearchFieldDataType.String, searchable=True), + SimpleField(name="BaseRate", type=SearchFieldDataType.Double), + SearchableField( + name="Description", type=SearchFieldDataType.String, collection=True + ), ComplexField( - name="address", + name="Address", fields=[ - SimpleField(name="streetAddress", type=SearchFieldDataType.String), - SimpleField(name="city", type=SearchFieldDataType.String), + SimpleField(name="StreetAddress", type=SearchFieldDataType.String), + SimpleField(name="City", type=SearchFieldDataType.String), ], collection=True, ), ] cors_options = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60) scoring_profiles: List[ScoringProfile] = [] -index = SearchIndex(name=name, fields=fields, scoring_profiles=scoring_profiles, cors_options=cors_options) - -result = client.create_index(index) +index = SearchIndex( + name=index_name, + fields=fields, + scoring_profiles=scoring_profiles, + cors_options=cors_options, +) + +result = index_client.create_index(index) +print(f"Created: index '{result.name}'") ``` @@ -266,17 +285,38 @@ an index in a single batched request. There are [a few special rules for merging](https://learn.microsoft.com/rest/api/searchservice/addupdate-or-delete-documents#document-actions) to be aware of. - + ```python -DOCUMENT = { - "hotelId": "1000", - "hotelName": "Azure Inn", +from azure.core.credentials import AzureKeyCredential +from azure.search.documents import SearchClient + +search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + +document = { + "HotelId": "100", + "HotelName": "Azure Sanctuary", + "Description": "A quiet retreat offering understated elegance and premium amenities.", + "Description_fr": "Meilleur hôtel en ville si vous aimez les hôtels de luxe.", + "Category": "Luxury", + "Tags": [ + "pool", + "view", + "wifi", + "concierge", + "private beach", + "gourmet dining", + "spa", + ], + "ParkingIncluded": False, + "LastRenovationDate": "2024-01-15T00:00:00+00:00", + "Rating": 5, + "Location": {"type": "Point", "coordinates": [-122.131577, 47.678581]}, } -result = search_client.upload_documents(documents=[DOCUMENT]) +result = search_client.upload_documents(documents=[document]) -print("Upload of new document succeeded: {}".format(result[0].succeeded)) +print(f"Uploaded: document 100 (succeeded={result[0].succeeded})") ``` @@ -309,7 +349,7 @@ 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. - + ```python from azure.core.credentials import AzureKeyCredential @@ -317,10 +357,11 @@ from azure.search.documents import SearchClient search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) -result = search_client.get_document(key="23") +result = search_client.get_document(key="100") -print("Details for hotel '23' are:") -print(" Name: {}".format(result["hotelName"])) +print("Result:") +print(f" HotelId: 100") +print(f" HotelName: {result['HotelName']}") ``` @@ -333,7 +374,7 @@ See [azure-core documentation](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md#transport) for more information. - + ```python from azure.core.credentials import AzureKeyCredential @@ -344,9 +385,9 @@ search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(ke async with search_client: results = await search_client.search(search_text="spa") - print("Hotels containing 'spa' in the name (or other fields):") + print("Results: hotels with 'spa'") async for result in results: - print(" Name: {} (rating {})".format(result["hotelName"], result["rating"])) + print(f" HotelName: {result['HotelName']} (rating {result['Rating']})") ``` diff --git a/sdk/search/azure-search-documents/azure/search/documents/_search_client.py b/sdk/search/azure-search-documents/azure/search/documents/_search_client.py index 7b46cf50f5e8..d7cc1b0088aa 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_search_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_search_client.py @@ -57,8 +57,8 @@ class SearchClient(HeadersMixin): .. admonition:: Example: .. literalinclude:: ../samples/sample_authentication.py - :start-after: [START create_search_client_with_key] - :end-before: [END create_search_client_with_key] + :start-after: [START authenticate_search_client_with_api_key] + :end-before: [END authenticate_search_client_with_api_key] :language: python :dedent: 4 :caption: Creating the SearchClient with an API key. @@ -130,7 +130,7 @@ def get_document(self, key: str, selected_fields: Optional[List[str]] = None, ** .. admonition:: Example: - .. literalinclude:: ../samples/sample_get_document.py + .. literalinclude:: ../samples/sample_documents_crud.py :start-after: [START get_document] :end-before: [END get_document] :language: python @@ -323,7 +323,7 @@ def search( .. admonition:: Example: - .. literalinclude:: ../samples/sample_simple_query.py + .. literalinclude:: ../samples/sample_query_simple.py :start-after: [START simple_query] :end-before: [END simple_query] :language: python @@ -332,7 +332,7 @@ def search( .. admonition:: Example: - .. literalinclude:: ../samples/sample_filter_query.py + .. literalinclude:: ../samples/sample_query_filter.py :start-after: [START filter_query] :end-before: [END filter_query] :language: python @@ -341,7 +341,7 @@ def search( .. admonition:: Example: - .. literalinclude:: ../samples/sample_facet_query.py + .. literalinclude:: ../samples/sample_query_facets.py :start-after: [START facet_query] :end-before: [END facet_query] :language: python @@ -466,7 +466,7 @@ def suggest( .. admonition:: Example: - .. literalinclude:: ../samples/sample_suggestions.py + .. literalinclude:: ../samples/sample_query_suggestions.py :start-after: [START suggest_query] :end-before: [END suggest_query] :language: python @@ -548,7 +548,7 @@ def autocomplete( .. admonition:: Example: - .. literalinclude:: ../samples/sample_autocomplete.py + .. literalinclude:: ../samples/sample_query_autocomplete.py :start-after: [START autocomplete_query] :end-before: [END autocomplete_query] :language: python @@ -593,7 +593,7 @@ def upload_documents(self, documents: List[Dict], **kwargs: Any) -> List[Indexin .. admonition:: Example: - .. literalinclude:: ../samples/sample_crud_operations.py + .. literalinclude:: ../samples/sample_documents_crud.py :start-after: [START upload_document] :end-before: [END upload_document] :language: python @@ -627,7 +627,7 @@ def delete_documents(self, documents: List[Dict], **kwargs: Any) -> List[Indexin .. admonition:: Example: - .. literalinclude:: ../samples/sample_crud_operations.py + .. literalinclude:: ../samples/sample_documents_crud.py :start-after: [START delete_document] :end-before: [END delete_document] :language: python @@ -657,7 +657,7 @@ def merge_documents(self, documents: List[Dict], **kwargs: Any) -> List[Indexing .. admonition:: Example: - .. literalinclude:: ../samples/sample_crud_operations.py + .. literalinclude:: ../samples/sample_documents_crud.py :start-after: [START merge_document] :end-before: [END merge_document] :language: python diff --git a/sdk/search/azure-search-documents/azure/search/documents/aio/_search_client_async.py b/sdk/search/azure-search-documents/azure/search/documents/aio/_search_client_async.py index a8d4125fb9e2..e39a7f24b04f 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/aio/_search_client_async.py +++ b/sdk/search/azure-search-documents/azure/search/documents/aio/_search_client_async.py @@ -58,8 +58,8 @@ class SearchClient(HeadersMixin): .. admonition:: Example: .. literalinclude:: ../samples/async_samples/sample_authentication_async.py - :start-after: [START create_search_client_with_key_async] - :end-before: [END create_search_client_with_key_async] + :start-after: [START authenticate_search_client_with_api_key_async] + :end-before: [END authenticate_search_client_with_api_key_async] :language: python :dedent: 4 :caption: Creating the SearchClient with an API key. @@ -132,7 +132,7 @@ async def get_document(self, key: str, selected_fields: Optional[List[str]] = No .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_get_document_async.py + .. literalinclude:: ../samples/async_samples/sample_documents_crud_async.py :start-after: [START get_document_async] :end-before: [END get_document_async] :language: python @@ -327,7 +327,7 @@ async def search( .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_simple_query_async.py + .. literalinclude:: ../samples/async_samples/sample_query_simple_async.py :start-after: [START simple_query_async] :end-before: [END simple_query_async] :language: python @@ -336,7 +336,7 @@ async def search( .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_filter_query_async.py + .. literalinclude:: ../samples/async_samples/sample_query_filter_async.py :start-after: [START filter_query_async] :end-before: [END filter_query_async] :language: python @@ -345,7 +345,7 @@ async def search( .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_facet_query_async.py + .. literalinclude:: ../samples/async_samples/sample_query_facets_async.py :start-after: [START facet_query_async] :end-before: [END facet_query_async] :language: python @@ -463,7 +463,7 @@ async def suggest( .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_suggestions_async.py + .. literalinclude:: ../samples/async_samples/sample_query_suggestions_async.py :start-after: [START suggest_query_async] :end-before: [END suggest_query_async] :language: python @@ -545,7 +545,7 @@ async def autocomplete( .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_autocomplete_async.py + .. literalinclude:: ../samples/async_samples/sample_query_autocomplete_async.py :start-after: [START autocomplete_query_async] :end-before: [END autocomplete_query_async] :language: python @@ -590,7 +590,7 @@ async def upload_documents(self, documents: List[Dict], **kwargs: Any) -> List[I .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_crud_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_documents_crud_async.py :start-after: [START upload_document_async] :end-before: [END upload_document_async] :language: python @@ -624,7 +624,7 @@ async def delete_documents(self, documents: List[Dict], **kwargs: Any) -> List[I .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_crud_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_documents_crud_async.py :start-after: [START delete_document_async] :end-before: [END delete_document_async] :language: python @@ -654,7 +654,7 @@ async def merge_documents(self, documents: List[Dict], **kwargs: Any) -> List[In .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_crud_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_documents_crud_async.py :start-after: [START merge_document_async] :end-before: [END merge_document_async] :language: python diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_search_index_client.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_search_index_client.py index 416614659f05..e8f8dec5cbb0 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_search_index_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_search_index_client.py @@ -150,7 +150,7 @@ def get_index(self, name: str, **kwargs: Any) -> SearchIndex: .. admonition:: Example: - .. literalinclude:: ../samples/sample_index_crud_operations.py + .. literalinclude:: ../samples/sample_index_crud.py :start-after: [START get_index] :end-before: [END get_index] :language: python @@ -196,7 +196,7 @@ def delete_index( .. admonition:: Example: - .. literalinclude:: ../samples/sample_index_crud_operations.py + .. literalinclude:: ../samples/sample_index_crud.py :start-after: [START delete_index] :end-before: [END delete_index] :language: python @@ -224,7 +224,7 @@ def create_index(self, index: SearchIndex, **kwargs: Any) -> SearchIndex: .. admonition:: Example: - .. literalinclude:: ../samples/sample_index_crud_operations.py + .. literalinclude:: ../samples/sample_index_crud.py :start-after: [START create_index] :end-before: [END create_index] :language: python @@ -267,7 +267,7 @@ def create_or_update_index( .. admonition:: Example: - .. literalinclude:: ../samples/sample_index_crud_operations.py + .. literalinclude:: ../samples/sample_index_crud.py :start-after: [START update_index] :end-before: [END update_index] :language: python @@ -302,7 +302,7 @@ def analyze_text(self, index_name: str, analyze_request: AnalyzeTextOptions, **k .. admonition:: Example: - .. literalinclude:: ../samples/sample_analyze_text.py + .. literalinclude:: ../samples/sample_index_analyze_text.py :start-after: [START simple_analyze_text] :end-before: [END simple_analyze_text] :language: python @@ -331,7 +331,7 @@ def get_synonym_maps(self, *, select: Optional[List[str]] = None, **kwargs) -> L .. admonition:: Example: - .. literalinclude:: ../samples/sample_synonym_map_operations.py + .. literalinclude:: ../samples/sample_index_synonym_map_crud.py :start-after: [START get_synonym_maps] :end-before: [END get_synonym_maps] :language: python @@ -373,7 +373,7 @@ def get_synonym_map(self, name: str, **kwargs: Any) -> SynonymMap: .. admonition:: Example: - .. literalinclude:: ../samples/sample_synonym_map_operations.py + .. literalinclude:: ../samples/sample_index_synonym_map_crud.py :start-after: [START get_synonym_map] :end-before: [END get_synonym_map] :language: python @@ -404,7 +404,7 @@ def delete_synonym_map( .. admonition:: Example: - .. literalinclude:: ../samples/sample_synonym_map_operations.py + .. literalinclude:: ../samples/sample_index_synonym_map_crud.py :start-after: [START delete_synonym_map] :end-before: [END delete_synonym_map] :language: python @@ -432,7 +432,7 @@ def create_synonym_map(self, synonym_map: SynonymMap, **kwargs: Any) -> SynonymM .. admonition:: Example: - .. literalinclude:: ../samples/sample_synonym_map_operations.py + .. literalinclude:: ../samples/sample_index_synonym_map_crud.py :start-after: [START create_synonym_map] :end-before: [END create_synonym_map] :language: python @@ -565,7 +565,7 @@ def delete_alias( .. admonition:: Example: - .. literalinclude:: ../samples/sample_index_alias_crud_operations.py + .. literalinclude:: ../samples/sample_index_alias_crud.py :start-after: [START delete_alias] :end-before: [END delete_alias] :language: python @@ -593,7 +593,7 @@ def create_alias(self, alias: SearchAlias, **kwargs: Any) -> SearchAlias: .. admonition:: Example: - .. literalinclude:: ../samples/sample_index_alias_crud_operations.py + .. literalinclude:: ../samples/sample_index_alias_crud.py :start-after: [START create_alias] :end-before: [END create_alias] :language: python @@ -625,7 +625,7 @@ def create_or_update_alias( .. admonition:: Example: - .. literalinclude:: ../samples/sample_index_alias_crud_operations.py + .. literalinclude:: ../samples/sample_index_alias_crud.py :start-after: [START update_alias] :end-before: [END update_alias] :language: python diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_search_indexer_client.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_search_indexer_client.py index b41006ac5158..f3e79eae4898 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_search_indexer_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_search_indexer_client.py @@ -97,7 +97,7 @@ def create_indexer(self, indexer: SearchIndexer, **kwargs: Any) -> SearchIndexer .. admonition:: Example: - .. literalinclude:: ../samples/sample_indexers_operations.py + .. literalinclude:: ../samples/sample_indexer_crud.py :start-after: [START create_indexer] :end-before: [END create_indexer] :language: python @@ -160,7 +160,7 @@ def get_indexer(self, name: str, **kwargs: Any) -> SearchIndexer: .. admonition:: Example: - .. literalinclude:: ../samples/sample_indexers_operations.py + .. literalinclude:: ../samples/sample_indexer_crud.py :start-after: [START get_indexer] :end-before: [END get_indexer] :language: python @@ -184,9 +184,9 @@ def get_indexers(self, *, select: Optional[List[str]] = None, **kwargs: Any) -> .. admonition:: Example: - .. literalinclude:: ../samples/sample_indexers_operations.py - :start-after: [START list_indexer] - :end-before: [END list_indexer] + .. literalinclude:: ../samples/sample_indexer_crud.py + :start-after: [START list_indexers] + :end-before: [END list_indexers] :language: python :dedent: 4 :caption: List all the SearchIndexers @@ -208,9 +208,9 @@ def get_indexer_names(self, **kwargs: Any) -> Sequence[str]: .. admonition:: Example: - .. literalinclude:: ../samples/sample_indexers_operations.py - :start-after: [START list_indexer] - :end-before: [END list_indexer] + .. literalinclude:: ../samples/sample_indexer_crud.py + :start-after: [START list_indexers] + :end-before: [END list_indexers] :language: python :dedent: 4 :caption: List all the SearchIndexers @@ -239,7 +239,7 @@ def delete_indexer( .. admonition:: Example: - .. literalinclude:: ../samples/sample_indexers_operations.py + .. literalinclude:: ../samples/sample_indexer_crud.py :start-after: [START delete_indexer] :end-before: [END delete_indexer] :language: python @@ -264,7 +264,7 @@ def run_indexer(self, name: str, **kwargs: Any) -> None: .. admonition:: Example: - .. literalinclude:: ../samples/sample_indexers_operations.py + .. literalinclude:: ../samples/sample_indexer_crud.py :start-after: [START run_indexer] :end-before: [END run_indexer] :language: python @@ -283,7 +283,7 @@ def reset_indexer(self, name: str, **kwargs: Any) -> None: .. admonition:: Example: - .. literalinclude:: ../samples/sample_indexers_operations.py + .. literalinclude:: ../samples/sample_indexer_crud.py :start-after: [START reset_indexer] :end-before: [END reset_indexer] :language: python @@ -363,7 +363,7 @@ def get_indexer_status(self, name: str, **kwargs: Any) -> SearchIndexerStatus: .. admonition:: Example: - .. literalinclude:: ../samples/sample_indexers_operations.py + .. literalinclude:: ../samples/sample_indexer_crud.py :start-after: [START get_indexer_status] :end-before: [END get_indexer_status] :language: python @@ -386,7 +386,7 @@ def create_data_source_connection( .. admonition:: Example: - .. literalinclude:: ../samples/sample_data_source_operations.py + .. literalinclude:: ../samples/sample_indexer_datasource_crud.py :start-after: [START create_data_source_connection] :end-before: [END create_data_source_connection] :language: python @@ -447,7 +447,7 @@ def get_data_source_connection(self, name: str, **kwargs: Any) -> SearchIndexerD .. admonition:: Example: - .. literalinclude:: ../samples/sample_data_source_operations.py + .. literalinclude:: ../samples/sample_indexer_datasource_crud.py :start-after: [START get_data_source_connection] :end-before: [END get_data_source_connection] :language: python @@ -474,9 +474,9 @@ def get_data_source_connections( .. admonition:: Example: - .. literalinclude:: ../samples/sample_data_source_operations.py - :start-after: [START list_data_source_connection] - :end-before: [END list_data_source_connection] + .. literalinclude:: ../samples/sample_indexer_datasource_crud.py + :start-after: [START list_data_source_connections] + :end-before: [END list_data_source_connections] :language: python :dedent: 4 :caption: List all the SearchIndexerDataSourceConnections @@ -524,7 +524,7 @@ def delete_data_source_connection( .. admonition:: Example: - .. literalinclude:: ../samples/sample_data_source_operations.py + .. literalinclude:: ../samples/sample_indexer_datasource_crud.py :start-after: [START delete_data_source_connection] :end-before: [END delete_data_source_connection] :language: python diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_search_index_client.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_search_index_client.py index e33e978a6fd6..d3ab23909374 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_search_index_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_search_index_client.py @@ -148,7 +148,7 @@ async def get_index(self, name: str, **kwargs: Any) -> SearchIndex: .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_index_crud_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_index_crud_async.py :start-after: [START get_index_async] :end-before: [END get_index_async] :language: python @@ -193,7 +193,7 @@ async def delete_index( .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_index_crud_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_index_crud_async.py :start-after: [START delete_index_async] :end-before: [END delete_index_async] :language: python @@ -221,7 +221,7 @@ async def create_index(self, index: SearchIndex, **kwargs: Any) -> SearchIndex: .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_index_crud_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_index_crud_async.py :start-after: [START create_index_async] :end-before: [END create_index_async] :language: python @@ -264,7 +264,7 @@ async def create_or_update_index( .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_index_crud_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_index_crud_async.py :start-after: [START update_index_async] :end-before: [END update_index_async] :language: python @@ -299,7 +299,7 @@ async def analyze_text(self, index_name: str, analyze_request: AnalyzeTextOption .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_analyze_text_async.py + .. literalinclude:: ../samples/async_samples/sample_index_analyze_text_async.py :start-after: [START simple_analyze_text_async] :end-before: [END simple_analyze_text_async] :language: python @@ -328,7 +328,7 @@ async def get_synonym_maps(self, *, select: Optional[List[str]] = None, **kwargs .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_synonym_map_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_index_synonym_map_crud_async.py :start-after: [START get_synonym_maps_async] :end-before: [END get_synonym_maps_async] :language: python @@ -370,7 +370,7 @@ async def get_synonym_map(self, name: str, **kwargs: Any) -> SynonymMap: .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_synonym_map_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_index_synonym_map_crud_async.py :start-after: [START get_synonym_map_async] :end-before: [END get_synonym_map_async] :language: python @@ -401,7 +401,7 @@ async def delete_synonym_map( .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_synonym_map_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_index_synonym_map_crud_async.py :start-after: [START delete_synonym_map_async] :end-before: [END delete_synonym_map_async] :language: python @@ -429,7 +429,7 @@ async def create_synonym_map(self, synonym_map: SynonymMap, **kwargs: Any) -> Sy .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_synonym_map_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_index_synonym_map_crud_async.py :start-after: [START create_synonym_map_async] :end-before: [END create_synonym_map_async] :language: python @@ -560,7 +560,7 @@ async def delete_alias( .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_index_alias_crud_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_index_alias_crud_async.py :start-after: [START delete_alias_async] :end-before: [END delete_alias_async] :language: python @@ -588,7 +588,7 @@ async def create_alias(self, alias: SearchAlias, **kwargs: Any) -> SearchAlias: .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_index_alias_crud_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_index_alias_crud_async.py :start-after: [START create_alias_async] :end-before: [END create_alias_async] :language: python @@ -619,7 +619,7 @@ async def create_or_update_alias( .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_index_alias_crud_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_index_alias_crud_async.py :start-after: [START update_alias_async] :end-before: [END update_alias_async] :language: python diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_search_indexer_client.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_search_indexer_client.py index 97d0505db5af..b984ba1c8ce8 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_search_indexer_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_search_indexer_client.py @@ -92,7 +92,7 @@ async def create_indexer(self, indexer: SearchIndexer, **kwargs: Any) -> SearchI .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_indexers_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_indexer_crud_async.py :start-after: [START create_indexer_async] :end-before: [END create_indexer_async] :language: python @@ -155,7 +155,7 @@ async def get_indexer(self, name: str, **kwargs: Any) -> SearchIndexer: .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_indexers_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_indexer_crud_async.py :start-after: [START get_indexer_async] :end-before: [END get_indexer_async] :language: python @@ -179,9 +179,9 @@ async def get_indexers(self, *, select: Optional[List[str]] = None, **kwargs) -> .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_indexers_operations_async.py - :start-after: [START list_indexer_async] - :end-before: [END list_indexer_async] + .. literalinclude:: ../samples/async_samples/sample_indexer_crud_async.py + :start-after: [START list_indexers_async] + :end-before: [END list_indexers_async] :language: python :dedent: 4 :caption: List all the SearchIndexers @@ -225,7 +225,7 @@ async def delete_indexer( .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_indexers_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_indexer_crud_async.py :start-after: [START delete_indexer_async] :end-before: [END delete_indexer_async] :language: python @@ -250,7 +250,7 @@ async def run_indexer(self, name: str, **kwargs: Any) -> None: .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_indexers_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_indexer_crud_async.py :start-after: [START run_indexer_async] :end-before: [END run_indexer_async] :language: python @@ -269,7 +269,7 @@ async def reset_indexer(self, name: str, **kwargs: Any) -> None: .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_indexers_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_indexer_crud_async.py :start-after: [START reset_indexer_async] :end-before: [END reset_indexer_async] :language: python @@ -351,7 +351,7 @@ async def get_indexer_status(self, name: str, **kwargs: Any) -> SearchIndexerSta .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_indexers_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_indexer_crud_async.py :start-after: [START get_indexer_status_async] :end-before: [END get_indexer_status_async] :language: python @@ -374,7 +374,7 @@ async def create_data_source_connection( .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_data_source_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_indexer_datasource_crud_async.py :start-after: [START create_data_source_connection_async] :end-before: [END create_data_source_connection_async] :language: python @@ -445,7 +445,7 @@ async def delete_data_source_connection( .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_data_source_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_indexer_datasource_crud_async.py :start-after: [START delete_data_source_connection_async] :end-before: [END delete_data_source_connection_async] :language: python @@ -481,7 +481,7 @@ async def get_data_source_connection( .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_data_source_operations_async.py + .. literalinclude:: ../samples/async_samples/sample_indexer_datasource_crud_async.py :start-after: [START get_data_source_connection_async] :end-before: [END get_data_source_connection_async] :language: python @@ -504,9 +504,9 @@ async def get_data_source_connections(self, **kwargs: Any) -> Sequence[SearchInd .. admonition:: Example: - .. literalinclude:: ../samples/async_samples/sample_data_source_operations_async.py - :start-after: [START list_data_source_connection_async] - :end-before: [END list_data_source_connection_async] + .. literalinclude:: ../samples/async_samples/sample_indexer_datasource_crud_async.py + :start-after: [START list_data_source_connections_async] + :end-before: [END list_data_source_connections_async] :language: python :dedent: 4 :caption: List all SearchIndexerDataSourceConnections diff --git a/sdk/search/azure-search-documents/samples/README.md b/sdk/search/azure-search-documents/samples/README.md index 9a658a5cd783..136a99218440 100644 --- a/sdk/search/azure-search-documents/samples/README.md +++ b/sdk/search/azure-search-documents/samples/README.md @@ -7,67 +7,65 @@ products: - azure-search --- -# Samples for Azure Cognitive Search client library for Python +# Azure AI Search Client Library Samples for Python -These code samples show common scenario operations with the Azure Cognitive -Search client library. +These samples demonstrate common scenarios and operations using the Azure AI Search client library. -Authenticate the client with a Azure Cognitive Search [API Key Credential](https://learn.microsoft.com/azure/search/search-security-api-keys): - -[https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/search/azure-search-documents/samples/sample_authentication.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_authentication.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_authentication_async.py)) - -Then for common search index operations: - -* Get a document by key: [sample_get_document.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_get_document.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_get_document_async.py)) - -* Perform a simple text query: [sample_simple_query.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_simple_query.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_simple_query_async.py)) - -* Perform a filtered query: [sample_filter_query.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_filter_query.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_filter_query_async.py)) - -* Perform a faceted query: [sample_facet_query.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_facet_query.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_facet_query_async.py)) - -* Get auto-completions: [sample_autocomplete.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_autocomplete.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_autocomplete_async.py)) - -* Get search suggestions: [sample_suggestions.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_suggestions.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_suggestions_async.py)) +## Prerequisites -* Perform basic document updates: [sample_crud_operations.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_crud_operations.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_crud_operations_async.py)) +* Python 3.10 or later +* An [Azure subscription](https://azure.microsoft.com/free/) +* An Azure AI Search service +* An index named `hotels-sample-index` created using the 'Import data' wizard with the 'hotels-sample' data source. See [Quickstart: Create a search index in the Azure portal](https://learn.microsoft.com/azure/search/search-get-started-portal?pivots=import-data). +* An Azure Storage account and a blob container named `hotels-sample-container` -* CRUD operations for index: [sample_index_crud_operations.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_index_crud_operations.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_index_crud_operations_async.py)) +### Install the package +```bash +pip install azure-search-documents +``` -* Analyze text: [sample_analyze_text.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_analyze_text.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_analyze_text_async.py)) +## Examples -* CRUD operations for indexers: [sample_indexers_operations.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_indexers_operations.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_indexers_operations_async.py)) +### Authentication -* General workflow of indexer, datasource and index: [sample_indexer_datasource_skillset.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_indexer_datasource_skillset.py) +* Authenticate the client with an API Key: [sample_authentication.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_authentication.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_authentication_async.py)) -* Semantic search: [sample_semantic_search.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_semantic_search.py) +### Document Operations -* Vector search: [sample_vector_search.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_vector_search.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_vector_search_async.py)) +* Upload, merge, get, and delete documents: [sample_documents_crud.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_documents_crud.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_documents_crud_async.py)) +* High-throughput indexing with buffering: [sample_documents_buffered_sender.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_documents_buffered_sender.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_documents_buffered_sender_async.py)) -## Prerequisites +### Query Operations -* Python 3.8 or later is required to use this package -* You must have an [Azure subscription](https://azure.microsoft.com/free/) -* You must create the "Hotels" sample index [in the Azure Portal](https://learn.microsoft.com/azure/search/search-get-started-portal) +* Simple text search: [sample_query_simple.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_query_simple.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_query_simple_async.py)) +* Filter and sort search results: [sample_query_filter.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_query_filter.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_query_filter_async.py)) +* Faceted search: [sample_query_facets.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_query_facets.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_query_facets_async.py)) +* Autocomplete suggestions: [sample_query_autocomplete.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_query_autocomplete.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_query_autocomplete_async.py)) +* Search suggestions: [sample_query_suggestions.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_query_suggestions.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_query_suggestions_async.py)) +* Semantic search: [sample_query_semantic.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_query_semantic.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_query_semantic_async.py)) +* Vector search: [sample_query_vector.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_query_vector.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_query_vector_async.py)) +* Session consistency: [sample_query_session.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_query_session.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_query_session_async.py)) -## Setup +### Index Operations -1. Install the Azure Cognitive Search client library for Python with [pip](https://pypi.org/project/pip/): +* Create, get, update, and delete indexes: [sample_index_crud.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_index_crud.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_index_crud_async.py)) +* Analyze text: [sample_index_analyze_text.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_index_analyze_text.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_index_analyze_text_async.py)) +* Index aliases: [sample_index_alias_crud.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_index_alias_crud.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_index_alias_crud_async.py)) +* Synonym maps: [sample_index_synonym_map_crud.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_index_synonym_map_crud.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_index_synonym_map_crud_async.py)) - ```bash - pip install azure-search-documents --pre - ``` +### Indexer Operations -2. Clone or download [this repository](https://github.com/Azure/azure-sdk-for-python) -3. Open this sample folder in [Visual Studio Code](https://code.visualstudio.com) or your IDE of choice. +* Create, get, update, and delete indexers: [sample_indexer_crud.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_indexer_crud.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_indexer_crud_async.py)) +* Create, get, update, and delete data sources: [sample_indexer_datasource_crud.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_indexer_datasource_crud.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_indexer_datasource_crud_async.py)) +* Indexer workflow (DataSource, Index, Skillset, Indexer): [sample_indexer_workflow.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_indexer_workflow.py) -## Running the samples +### Advanced -1. Open a terminal window and `cd` to the directory that the samples are saved in. -2. Set the environment variables specified in the sample file you wish to run. -3. Follow the usage described in the file, e.g. `python sample_simple_query.py` +* Custom HTTP requests (SearchClient): [sample_search_client_custom_request.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_search_client_custom_request.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_search_client_custom_request_async.py)) +* Custom HTTP requests (SearchIndexClient): [sample_index_client_custom_request.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_index_client_custom_request.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_index_client_custom_request_async.py)) +* Knowledge base agentic retrieval: [sample_agentic_retrieval.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_agentic_retrieval.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/async_samples/sample_agentic_retrieval_async.py)) ## Next steps -Check out the [API reference documentation](https://learn.microsoft.com/rest/api/searchservice/) -to learn more about what you can do with the Azure Cognitive Search client library. +Check out the [Azure AI Search REST API reference](https://learn.microsoft.com/rest/api/searchservice/) +to learn more about what you can do with the Azure AI Search client library. diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_agentic_retrieval_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_agentic_retrieval_async.py new file mode 100644 index 000000000000..16b76d380a48 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/async_samples/sample_agentic_retrieval_async.py @@ -0,0 +1,221 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates Knowledge Source and Knowledge Base CRUD operations and + a minimal retrieval query using a semantic intent. + +USAGE: + python sample_agentic_retrieval_async.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the admin key for your search service +""" + +import asyncio +import json +import os + +from azure.core.credentials import AzureKeyCredential +from azure.core.exceptions import ResourceNotFoundError +from azure.search.documents.indexes.aio import SearchIndexClient +from azure.search.documents.knowledgebases.aio import KnowledgeBaseRetrievalClient +from azure.search.documents.knowledgebases.models import ( + KnowledgeBaseRetrievalRequest, + KnowledgeRetrievalSemanticIntent, +) +from azure.search.documents.indexes.models import ( + KnowledgeBase, + KnowledgeSourceReference, + KnowledgeRetrievalMinimalReasoningEffort, + SearchIndexFieldReference, + SearchIndexKnowledgeSource, + SearchIndexKnowledgeSourceParameters, +) + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] + +knowledge_source_name = "hotels-sample-knowledge-source" +knowledge_base_name = "hotels-sample-knowledge-base" + + +async def create_knowledge_source_async(): + # [START create_knowledge_source_async] + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + knowledge_source = SearchIndexKnowledgeSource( + name=knowledge_source_name, + search_index_parameters=SearchIndexKnowledgeSourceParameters( + search_index_name=index_name + ), + ) + + async with index_client: + await index_client.create_or_update_knowledge_source( + knowledge_source=knowledge_source + ) + print(f"Created: knowledge source '{knowledge_source_name}'") + # [END create_knowledge_source_async] + + +async def get_knowledge_source_async(): + # [START get_knowledge_source_async] + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + async with index_client: + knowledge_source = await index_client.get_knowledge_source( + knowledge_source_name + ) + print(f"Retrieved: knowledge source '{knowledge_source.name}'") + # [END get_knowledge_source_async] + + +async def update_knowledge_source_async(): + # [START update_knowledge_source_async] + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + knowledge_source = SearchIndexKnowledgeSource( + name=knowledge_source_name, + search_index_parameters=SearchIndexKnowledgeSourceParameters( + search_index_name=index_name, + source_data_fields=[ + SearchIndexFieldReference(name="HotelId"), + SearchIndexFieldReference(name="HotelName"), + SearchIndexFieldReference(name="Description"), + SearchIndexFieldReference(name="Category"), + SearchIndexFieldReference(name="Tags"), + ], + ), + ) + + async with index_client: + await index_client.create_or_update_knowledge_source( + knowledge_source=knowledge_source + ) + print(f"Updated: knowledge source '{knowledge_source_name}'") + # [END update_knowledge_source_async] + + +async def delete_knowledge_source_async(): + # [START delete_knowledge_source_async] + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + try: + async with index_client: + await index_client.delete_knowledge_source(knowledge_source_name) + print(f"Deleted: knowledge source '{knowledge_source_name}'") + except ResourceNotFoundError: + print(f"Skipped: knowledge source '{knowledge_source_name}' not found") + # [END delete_knowledge_source_async] + + +async def create_knowledge_base_async(): + # [START create_knowledge_base_async] + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + knowledge_base = KnowledgeBase( + name=knowledge_base_name, + knowledge_sources=[KnowledgeSourceReference(name=knowledge_source_name)], + ) + + async with index_client: + await index_client.create_or_update_knowledge_base(knowledge_base) + print(f"Created: knowledge base '{knowledge_base_name}'") + # [END create_knowledge_base_async] + + +async def get_knowledge_base_async(): + # [START get_knowledge_base_async] + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + async with index_client: + knowledge_base = await index_client.get_knowledge_base(knowledge_base_name) + print(f"Retrieved: knowledge base '{knowledge_base.name}'") + # [END get_knowledge_base_async] + + +async def update_knowledge_base_async(): + # [START update_knowledge_base_async] + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + knowledge_base = KnowledgeBase( + name=knowledge_base_name, + knowledge_sources=[KnowledgeSourceReference(name=knowledge_source_name)], + retrieval_reasoning_effort=KnowledgeRetrievalMinimalReasoningEffort(), + ) + + async with index_client: + await index_client.create_or_update_knowledge_base(knowledge_base) + print(f"Updated: knowledge base '{knowledge_base_name}'") + # [END update_knowledge_base_async] + + +async def retrieve_knowledge_base_async(): + # [START retrieve_knowledge_base_async] + retrieval_client = KnowledgeBaseRetrievalClient( + service_endpoint, + knowledge_base_name=knowledge_base_name, + credential=AzureKeyCredential(key), + ) + + request = KnowledgeBaseRetrievalRequest( + intents=[KnowledgeRetrievalSemanticIntent(search="hotels with free wifi")] + ) + + try: + result = await retrieval_client.retrieve(request) + finally: + await retrieval_client.close() + + print("Results: knowledge base retrieval") + + response_parts = [] + for resp in result.response or []: + for content in resp.content or []: + if hasattr(content, "text"): + response_parts.append(content.text) + + if response_parts: + response_content = "\n\n".join(response_parts) + + items = json.loads(response_content) + for i, item in enumerate(items[:5], start=1): + print(f" Result {i}:") + print(f" Title: {item.get('title')}") + print(f" Content: {item.get('content')}") + else: + print("Results: none") + # [END retrieve_knowledge_base_async] + + +async def delete_knowledge_base_async(): + # [START delete_knowledge_base_async] + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + try: + async with index_client: + await index_client.delete_knowledge_base(knowledge_base_name) + print(f"Deleted: knowledge base '{knowledge_base_name}'") + except ResourceNotFoundError: + print(f"Skipped: knowledge base '{knowledge_base_name}' not found") + # [END delete_knowledge_base_async] + + +if __name__ == "__main__": + asyncio.run(create_knowledge_source_async()) + asyncio.run(get_knowledge_source_async()) + asyncio.run(update_knowledge_source_async()) + asyncio.run(create_knowledge_base_async()) + asyncio.run(get_knowledge_base_async()) + asyncio.run(update_knowledge_base_async()) + asyncio.run(retrieve_knowledge_base_async()) + asyncio.run(delete_knowledge_base_async()) + asyncio.run(delete_knowledge_source_async()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_analyze_text_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_analyze_text_async.py deleted file mode 100644 index a20a4d5cc4af..000000000000 --- a/sdk/search/azure-search-documents/samples/async_samples/sample_analyze_text_async.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_analyze_text_async.py -DESCRIPTION: - This sample demonstrates how to analyze text. -USAGE: - python sample_analyze_text_async.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import os -import asyncio - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] -key = os.environ["AZURE_SEARCH_API_KEY"] - - -async def simple_analyze_text(): - # [START simple_analyze_text_async] - from azure.core.credentials import AzureKeyCredential - from azure.search.documents.indexes.aio import SearchIndexClient - from azure.search.documents.indexes.models import AnalyzeTextOptions - - client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - - analyze_request = AnalyzeTextOptions(text="One's ", analyzer_name="standard.lucene") - - async with client: - result = await client.analyze_text(index_name, analyze_request) - print(result.as_dict()) - # [END simple_analyze_text_async] - - -if __name__ == "__main__": - asyncio.run(simple_analyze_text()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_authentication_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_authentication_async.py index e4340c96274c..a34dde17a4ae 100644 --- a/sdk/search/azure-search-documents/samples/async_samples/sample_authentication_async.py +++ b/sdk/search/azure-search-documents/samples/async_samples/sample_authentication_async.py @@ -1,31 +1,30 @@ # coding: utf-8 # ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. # -------------------------------------------------------------------------- """ -FILE: sample_authentication_async.py DESCRIPTION: - This sample demonstrates how to authenticate with the Azure Congnitive Search - service with an API key. See more details about authentication here: - https://learn.microsoft.com/azure.search.documents/search-security-api-keys + Demonstrates how to authenticate with the Azure AI Search service. + USAGE: python sample_authentication_async.py - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the admin key for your search service """ -import asyncio import os +import asyncio -async def authentication_with_api_key_credential_async(): - # [START create_search_client_with_key_async] +async def authenticate_search_client_with_api_key_async(): + # [START authenticate_search_client_with_api_key_async] from azure.core.credentials import AzureKeyCredential from azure.search.documents.aio import SearchClient @@ -34,28 +33,33 @@ async def authentication_with_api_key_credential_async(): key = os.environ["AZURE_SEARCH_API_KEY"] search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) - # [END create_search_client_with_key_async] + # [END authenticate_search_client_with_api_key_async] async with search_client: - result = await search_client.get_document_count() + document_count = await search_client.get_document_count() - print("There are {} documents in the {} search index.".format(result, index_name)) + print(f"Document count: {document_count} (index '{index_name}')") -async def authentication_service_client_with_api_key_credential_async(): - # [START create_search_service_with_key_async] +async def authenticate_index_client_with_api_key_async(): + # [START authenticate_index_client_with_api_key_async] from azure.core.credentials import AzureKeyCredential from azure.search.documents.indexes.aio import SearchIndexClient service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] key = os.environ["AZURE_SEARCH_API_KEY"] - client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - # [END create_search_service_with_key_async] + search_index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + # [END authenticate_index_client_with_api_key_async] + + async with search_index_client: + result = search_index_client.list_indexes() + names = [x.name async for x in result] + print(f"Indexes ({len(names)}): {', '.join(names)}") -async def authentication_with_aad(): - # [START authentication_with_aad] +async def authenticate_search_client_with_aad_async(): + # [START authenticate_search_client_with_aad_async] from azure.identity.aio import DefaultAzureCredential from azure.search.documents.aio import SearchClient @@ -64,28 +68,33 @@ async def authentication_with_aad(): credential = DefaultAzureCredential() search_client = SearchClient(service_endpoint, index_name, credential) - # [END authentication_with_aad] + # [END authenticate_search_client_with_aad_async] async with search_client: - result = await search_client.get_document_count() + document_count = await search_client.get_document_count() - print("There are {} documents in the {} search index.".format(result, index_name)) + print(f"Document count: {document_count} (index '{index_name}')") -async def authentication_service_client_with_aad(): - # [START authentication_service_client_with_aad] +async def authenticate_index_client_with_aad_async(): + # [START authenticate_index_client_with_aad_async] from azure.identity.aio import DefaultAzureCredential from azure.search.documents.indexes.aio import SearchIndexClient service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] credential = DefaultAzureCredential() - client = SearchIndexClient(service_endpoint, credential) - # [END authentication_service_client_with_aad] + search_index_client = SearchIndexClient(service_endpoint, credential) + # [END authenticate_index_client_with_aad_async] + + async with search_index_client: + result = search_index_client.list_indexes() + names = [x.name async for x in result] + print(f"Indexes ({len(names)}): {', '.join(names)}") if __name__ == "__main__": - asyncio.run(authentication_with_api_key_credential_async()) - asyncio.run(authentication_service_client_with_api_key_credential_async()) - asyncio.run(authentication_with_aad()) - asyncio.run(authentication_service_client_with_aad()) + asyncio.run(authenticate_search_client_with_api_key_async()) + asyncio.run(authenticate_index_client_with_api_key_async()) + asyncio.run(authenticate_search_client_with_aad_async()) + asyncio.run(authenticate_index_client_with_aad_async()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_autocomplete_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_autocomplete_async.py deleted file mode 100644 index 856652212a40..000000000000 --- a/sdk/search/azure-search-documents/samples/async_samples/sample_autocomplete_async.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_autocomplete_async.py -DESCRIPTION: - This sample demonstrates how to obtain autocompletion suggestions from an - Azure search index. -USAGE: - python sample_autocomplete_async.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import os -import asyncio - - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] -key = os.environ["AZURE_SEARCH_API_KEY"] - - -async def autocomplete_query(): - # [START autocomplete_query_async] - from azure.core.credentials import AzureKeyCredential - from azure.search.documents.aio import SearchClient - - search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) - - async with search_client: - results = await search_client.autocomplete(search_text="bo", suggester_name="sg") - - print("Autocomplete suggestions for 'bo'") - for result in results: - print(" Completion: {}".format(result["text"])) - # [END autocomplete_query_async] - - -if __name__ == "__main__": - asyncio.run(autocomplete_query()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_buffered_sender_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_buffered_sender_async.py deleted file mode 100644 index 23b9aeae146c..000000000000 --- a/sdk/search/azure-search-documents/samples/async_samples/sample_buffered_sender_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_batch_client_async.py -DESCRIPTION: - This sample demonstrates how to upload, merge, or delete documents using SearchIndexingBufferedSender. -USAGE: - python sample_batch_client_async.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import os -import asyncio - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] -key = os.environ["AZURE_SEARCH_API_KEY"] - -from azure.core.credentials import AzureKeyCredential -from azure.search.documents.aio import SearchIndexingBufferedSender - - -async def sample_batching_client(): - DOCUMENT = { - "category": "Hotel", - "hotelId": "1000", - "rating": 4.0, - "rooms": [], - "hotelName": "Azure Inn", - } - - async with SearchIndexingBufferedSender(service_endpoint, index_name, AzureKeyCredential(key)) as batch_client: - # add upload actions - await batch_client.upload_documents(documents=[DOCUMENT]) - # add merge actions - await batch_client.merge_documents(documents=[{"hotelId": "1000", "rating": 4.5}]) - # add delete actions - await batch_client.delete_documents(documents=[{"hotelId": "1000"}]) - - -async def main(): - await sample_batching_client() - - -if __name__ == "__main__": - asyncio.run(main()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_crud_operations_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_crud_operations_async.py deleted file mode 100644 index 697d8d03ae10..000000000000 --- a/sdk/search/azure-search-documents/samples/async_samples/sample_crud_operations_async.py +++ /dev/null @@ -1,73 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_crud_operations_async.py -DESCRIPTION: - This sample demonstrates how to upload, merge, or delete documents from an - Azure Search index. -USAGE: - python sample_crud_operations_async.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import os -import asyncio - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] -key = os.environ["AZURE_SEARCH_API_KEY"] - -from azure.core.credentials import AzureKeyCredential -from azure.search.documents.aio import SearchClient - -search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) - - -async def upload_document(): - # [START upload_document_async] - DOCUMENT = { - "hotelId": "1000", - "hotelName": "Azure Inn", - } - - result = await search_client.upload_documents(documents=[DOCUMENT]) - - print("Upload of new document succeeded: {}".format(result[0].succeeded)) - # [END upload_document_async] - - -async def merge_document(): - # [START merge_document_async] - result = await search_client.upload_documents(documents=[{"hotelId": "783", "hotelName": "Renovated Ranch"}]) - - print("Merge into new document succeeded: {}".format(result[0].succeeded)) - # [END merge_document_async] - - -async def delete_document(): - # [START delete_document_async] - result = await search_client.upload_documents(documents=[{"hotelId": "1000"}]) - - print("Delete new document succeeded: {}".format(result[0].succeeded)) - # [END delete_document_async] - - -async def main(): - await upload_document() - await merge_document() - await delete_document() - await search_client.close() - - -if __name__ == "__main__": - asyncio.run(main()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_data_source_operations_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_data_source_operations_async.py deleted file mode 100644 index fd39b24abbe8..000000000000 --- a/sdk/search/azure-search-documents/samples/async_samples/sample_data_source_operations_async.py +++ /dev/null @@ -1,81 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_data_source_operations_async.py -DESCRIPTION: - This sample demonstrates how to get, create, update, or delete a Data Source. -USAGE: - python sample_data_source_operations_async.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_API_KEY - your search API key -""" - -import asyncio -import os - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -key = os.environ["AZURE_SEARCH_API_KEY"] -connection_string = os.environ["AZURE_STORAGE_CONNECTION_STRING"] - -from azure.core.credentials import AzureKeyCredential -from azure.search.documents.indexes.models import SearchIndexerDataContainer, SearchIndexerDataSourceConnection -from azure.search.documents.indexes.aio import SearchIndexerClient - -client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) - - -async def create_data_source_connection(): - # [START create_data_source_connection_async] - container = SearchIndexerDataContainer(name="searchcontainer") - data_source = SearchIndexerDataSourceConnection( - name="async-sample-data-source-connection", - type="azureblob", - connection_string=connection_string, - container=container, - ) - result = await client.create_data_source_connection(data_source) - print("Create new Data Source Connection - async-sample-data-source-connection") - # [END create_data_source_connection_async] - - -async def list_data_source_connections(): - # [START list_data_source_connection_async] - result = await client.get_data_source_connections() - names = [x.name for x in result] - print("Found {} Data Source Connections in the service: {}".format(len(result), ", ".join(names))) - # [END list_data_source_connection_async] - - -async def get_data_source_connection(): - # [START get_data_source_connection_async] - result = await client.get_data_source_connection("async-sample-data-source-connection") - print("Retrived Data Source Connection 'async-sample-data-source-connection'") - return result - # [END get_data_source_connection_async] - - -async def delete_data_source_connection(): - # [START delete_data_source_connection_async] - await client.delete_data_source_connection("async-sample-data-source-connection") - print("Data Source Connection 'async-sample-data-source-connection' successfully deleted") - # [END delete_data_source_connection_async] - - -async def main(): - await create_data_source_connection() - await list_data_source_connections() - await get_data_source_connection() - await delete_data_source_connection() - await client.close() - - -if __name__ == "__main__": - asyncio.run(main()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_documents_buffered_sender_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_documents_buffered_sender_async.py new file mode 100644 index 000000000000..8ff623d4df17 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/async_samples/sample_documents_buffered_sender_async.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to use the SearchIndexingBufferedSender for high-throughput indexing. + +USAGE: + python sample_documents_buffered_sender_async.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the admin key for your search service +""" + +import os +import asyncio + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] + + +async def sample_batching_client_async(): + # [START sample_batching_client_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.aio import SearchIndexingBufferedSender + + document = { + "HotelId": "100", + "HotelName": "Azure Sanctuary", + "Description": "A quiet retreat offering understated elegance and premium amenities.", + "Description_fr": "Meilleur hôtel en ville si vous aimez les hôtels de luxe.", + "Category": "Luxury", + "Tags": [ + "pool", + "view", + "wifi", + "concierge", + "private beach", + "gourmet dining", + "spa", + ], + "ParkingIncluded": False, + "LastRenovationDate": "2024-01-15T00:00:00+00:00", + "Rating": 5, + "Location": {"type": "Point", "coordinates": [-122.131577, 47.678581]}, + } + + async with SearchIndexingBufferedSender( + service_endpoint, index_name, AzureKeyCredential(key) + ) as buffered_sender: + # add upload actions + await buffered_sender.upload_documents(documents=[document]) + print(f"Uploaded: document {document['HotelId']}") + + # add merge actions + await buffered_sender.merge_documents( + documents=[{"HotelId": "100", "Rating": 4.5}] + ) + print(f"Merged: document {document['HotelId']}") + + # add delete actions + await buffered_sender.delete_documents(documents=[{"HotelId": "100"}]) + print(f"Deleted: document {document['HotelId']}") + # [END sample_batching_client_async] + + +if __name__ == "__main__": + asyncio.run(sample_batching_client_async()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_documents_crud_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_documents_crud_async.py new file mode 100644 index 000000000000..39d9db3e3d14 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/async_samples/sample_documents_crud_async.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to upload, merge, get, and delete documents. + +USAGE: + python sample_documents_crud_async.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the admin key for your search service +""" + +import os +import asyncio + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] + + +async def upload_document_async(): + # [START upload_document_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.aio import SearchClient + + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + document = { + "HotelId": "100", + "HotelName": "Azure Sanctuary", + "Description": "A quiet retreat offering understated elegance and premium amenities.", + "Description_fr": "Meilleur hôtel en ville si vous aimez les hôtels de luxe.", + "Category": "Luxury", + "Tags": [ + "pool", + "view", + "wifi", + "concierge", + "private beach", + "gourmet dining", + "spa", + ], + "ParkingIncluded": False, + "LastRenovationDate": "2024-01-15T00:00:00+00:00", + "Rating": 5, + "Location": {"type": "Point", "coordinates": [-122.131577, 47.678581]}, + } + + async with search_client: + result = await search_client.upload_documents(documents=[document]) + + print(f"Uploaded: document 100 (succeeded={result[0].succeeded})") + # [END upload_document_async] + + +async def merge_document_async(): + # [START merge_document_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.aio import SearchClient + + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + async with search_client: + result = await search_client.merge_documents( + documents=[{"HotelId": "100", "HotelName": "Azure Sanctuary & Spa"}] + ) + + print(f"Merged: document 100 (succeeded={result[0].succeeded})") + # [END merge_document_async] + + +async def get_document_async(): + # [START get_document_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.aio import SearchClient + + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + async with search_client: + result = await search_client.get_document(key="100") + + print("Result:") + print(f" HotelId: 100") + print(f" HotelName: {result['HotelName']}") + # [END get_document_async] + + +async def delete_document_async(): + # [START delete_document_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.aio import SearchClient + + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + async with search_client: + result = await search_client.delete_documents(documents=[{"HotelId": "100"}]) + + print(f"Deleted: document 100 (succeeded={result[0].succeeded})") + # [END delete_document_async] + + +if __name__ == "__main__": + asyncio.run(upload_document_async()) + asyncio.run(merge_document_async()) + asyncio.run(get_document_async()) + asyncio.run(delete_document_async()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_facet_query_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_facet_query_async.py deleted file mode 100644 index 1ce8666eabbd..000000000000 --- a/sdk/search/azure-search-documents/samples/async_samples/sample_facet_query_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_facet_query_async.py -DESCRIPTION: - This sample demonstrates how to obtain search facets on specified field in - an Azure Search index. -USAGE: - python sample_facet_query_async.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -from typing import List, Dict, cast -import os -import asyncio - - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] -key = os.environ["AZURE_SEARCH_API_KEY"] - - -async def filter_query(): - # [START facet_query_async] - from azure.core.credentials import AzureKeyCredential - from azure.search.documents.aio import SearchClient - - search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) - - async with search_client: - results = await search_client.search(search_text="WiFi", facets=["category,count:3", "parkingIncluded"]) - - facets: Dict[str, List[str]] = cast(Dict[str, List[str]], await results.get_facets()) - - print("Catgory facet counts for hotels:") - for facet in facets["category"]: - print(" {}".format(facet)) - # [END facet_query_async] - - -if __name__ == "__main__": - asyncio.run(filter_query()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_filter_query_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_filter_query_async.py deleted file mode 100644 index e8dc44bda617..000000000000 --- a/sdk/search/azure-search-documents/samples/async_samples/sample_filter_query_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_filter_query_async.py -DESCRIPTION: - This sample demonstrates how search results from an Azure Search index can - be filtered and ordered. -USAGE: - python sample_filter_query_async.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import os -import asyncio - - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] -key = os.environ["AZURE_SEARCH_API_KEY"] - - -async def filter_query(): - # [START filter_query_async] - from azure.core.credentials import AzureKeyCredential - from azure.search.documents.aio import SearchClient - - search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) - - async with search_client: - results = await search_client.search( - search_text="WiFi", - filter="Address/StateProvince eq 'FL' and Address/Country eq 'USA'", - select=["hotelName", "rating"], - order_by=["rating desc"], - ) - - print("Florida hotels containing 'WiFi', sorted by Rating:") - async for result in results: - print(" Name: {} (rating {})".format(result["hotelName"], result["rating"])) - # [END filter_query_async] - - -if __name__ == "__main__": - asyncio.run(filter_query()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_get_document_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_get_document_async.py deleted file mode 100644 index c9b177bef4eb..000000000000 --- a/sdk/search/azure-search-documents/samples/async_samples/sample_get_document_async.py +++ /dev/null @@ -1,48 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_get_document_async.py -DESCRIPTION: - This sample demonstrates how to retrieve a specific document by key from an - Azure Search index. -USAGE: - python sample_get_document_async.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import os -import asyncio - - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] -key = os.environ["AZURE_SEARCH_API_KEY"] - - -async def autocomplete_query(): - # [START get_document_async] - from azure.core.credentials import AzureKeyCredential - from azure.search.documents.aio import SearchClient - - search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) - - async with search_client: - result = await search_client.get_document(key="23") - - print("Details for hotel '23' are:") - print(" Name: {}".format(result["hotelName"])) - # [END get_document_async] - - -if __name__ == "__main__": - asyncio.run(autocomplete_query()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_index_alias_crud_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_index_alias_crud_async.py new file mode 100644 index 000000000000..7206721ffb9d --- /dev/null +++ b/sdk/search/azure-search-documents/samples/async_samples/sample_index_alias_crud_async.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to create, get, update, and delete an index alias. + +USAGE: + python sample_index_alias_crud_async.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_API_KEY - the admin key for your search service + 3) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") +""" + + +import asyncio +import os + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] +alias_name = "hotel-alias" +new_index_name = "hotels-sample-index-v2" + + +async def create_alias_async(): + # [START create_alias_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexClient + from azure.search.documents.indexes.models import SearchAlias + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + alias = SearchAlias(name=alias_name, indexes=[index_name]) + async with index_client: + result = await index_client.create_alias(alias) + print(f"Created: alias '{result.name}' -> index '{index_name}'") + # [END create_alias_async] + + +async def get_alias_async(): + # [START get_alias_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexClient + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + async with index_client: + result = await index_client.get_alias(alias_name) + print(f"Retrieved: alias '{result.name}'") + # [END get_alias_async] + + +async def update_alias_async(): + # [START update_alias_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexClient + from azure.search.documents.indexes.models import ( + ComplexField, + CorsOptions, + ScoringProfile, + SearchAlias, + SearchIndex, + SimpleField, + SearchableField, + SearchFieldDataType, + ) + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + # Create a new index with a different schema or settings + # In a real scenario, this would be your updated index version (e.g., v2) + fields = [ + SimpleField(name="HotelId", type=SearchFieldDataType.String, key=True), + SimpleField(name="BaseRate", type=SearchFieldDataType.Double), + SearchableField( + name="Description", type=SearchFieldDataType.String, collection=True + ), + SearchableField(name="HotelName", type=SearchFieldDataType.String), + ComplexField( + name="Address", + fields=[ + SimpleField(name="StreetAddress", type=SearchFieldDataType.String), + SimpleField(name="City", type=SearchFieldDataType.String), + SimpleField(name="State", type=SearchFieldDataType.String), + ], + collection=True, + ), + ] + cors_options = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60) + scoring_profile = ScoringProfile(name="MyProfile") + index = SearchIndex( + name=new_index_name, + fields=fields, + scoring_profiles=[scoring_profile], + cors_options=cors_options, + ) + + async with index_client: + await index_client.create_or_update_index(index=index) + print(f"Created: index '{new_index_name}'") + + # Update the alias to point to the new index + # This operation is atomic and ensures zero downtime for applications using the alias + alias = SearchAlias(name=alias_name, indexes=[new_index_name]) + result = await index_client.create_or_update_alias(alias) + print(f"Updated: alias '{result.name}' -> index '{new_index_name}'") + # [END update_alias_async] + + +async def delete_alias_async(): + # [START delete_alias_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexClient + from azure.core.exceptions import ResourceNotFoundError + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + async with index_client: + await index_client.delete_alias(alias_name) + print(f"Deleted: alias '{alias_name}'") + + try: + await index_client.delete_index(new_index_name) + print(f"Deleted: index '{new_index_name}'") + except ResourceNotFoundError: + print(f"Skipped: index '{new_index_name}' not found") + # [END delete_alias_async] + + +if __name__ == "__main__": + asyncio.run(create_alias_async()) + asyncio.run(get_alias_async()) + asyncio.run(update_alias_async()) + asyncio.run(delete_alias_async()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_index_alias_crud_operations_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_index_alias_crud_operations_async.py deleted file mode 100644 index 3a47a8fb8641..000000000000 --- a/sdk/search/azure-search-documents/samples/async_samples/sample_index_alias_crud_operations_async.py +++ /dev/null @@ -1,111 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_index_alias_crud_operations_async.py -DESCRIPTION: - This sample demonstrates how to get, create, update, or delete an alias with an existing index. -USAGE: - python sample_index_alias_crud_operations_async.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_API_KEY - your search API key - 3) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") -""" - - -import asyncio -import os - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] -key = os.environ["AZURE_SEARCH_API_KEY"] -alias_name = "motels" - -from azure.core.credentials import AzureKeyCredential -from azure.search.documents.indexes.aio import SearchIndexClient -from azure.search.documents.indexes.models import ( - ComplexField, - CorsOptions, - ScoringProfile, - SearchAlias, - SearchIndex, - SimpleField, - SearchableField, - SearchFieldDataType, -) - - -client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - - -async def create_alias(): - # [START create_alias_async] - alias = SearchAlias(name=alias_name, indexes=[index_name]) - result = await client.create_alias(alias) - # [END create_alias_async] - - -async def get_alias(): - # [START get_alias_async] - result = await client.get_alias(alias_name) - # [END get_alias_async] - - -async def update_alias(): - # [START update_alias_async] - new_index_name = "hotels" - fields = [ - SimpleField(name="hotelId", type=SearchFieldDataType.String, key=True), - SimpleField(name="baseRate", type=SearchFieldDataType.Double), - SearchableField(name="description", type=SearchFieldDataType.String, collection=True), - SearchableField(name="hotelName", type=SearchFieldDataType.String), - ComplexField( - name="address", - fields=[ - SimpleField(name="streetAddress", type=SearchFieldDataType.String), - SimpleField(name="city", type=SearchFieldDataType.String), - SimpleField(name="state", type=SearchFieldDataType.String), - ], - collection=True, - ), - ] - cors_options = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60) - scoring_profile = ScoringProfile(name="MyProfile") - scoring_profiles = [] - scoring_profiles.append(scoring_profile) - index = SearchIndex( - name=new_index_name, fields=fields, scoring_profiles=scoring_profiles, cors_options=cors_options - ) - - result_index = await client.create_or_update_index(index=index) - - alias = SearchAlias(name=alias_name, indexes=[new_index_name]) - result = await client.create_or_update_alias(alias) - - # [END update_alias_async] - - -async def delete_alias(): - # [START delete_alias_async] - - await client.delete_alias(alias_name) - # [END delete_alias_async] - - -async def main(): - await create_alias() - await get_alias() - await update_alias() - await delete_alias() - await client.close() - - -if __name__ == "__main__": - asyncio.run(main()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_index_analyze_text_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_index_analyze_text_async.py new file mode 100644 index 000000000000..e5ca9a20cb9d --- /dev/null +++ b/sdk/search/azure-search-documents/samples/async_samples/sample_index_analyze_text_async.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to analyze text using a specific analyzer. + +USAGE: + python sample_index_analyze_text_async.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the admin key for your search service +""" + +import os +import asyncio + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] + + +async def simple_analyze_text_async(): + # [START simple_analyze_text_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexClient + from azure.search.documents.indexes.models import AnalyzeTextOptions + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + analyze_request = AnalyzeTextOptions( + text="One's ", analyzer_name="standard.lucene" + ) + + async with index_client: + analysis_result = await index_client.analyze_text(index_name, analyze_request) + + print("Results:") + for token in analysis_result.tokens: + print( + f" Token: {token.token}, Start: {token.start_offset}, End: {token.end_offset}" + ) + # [END simple_analyze_text_async] + + +if __name__ == "__main__": + asyncio.run(simple_analyze_text_async()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_index_client_custom_request_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_index_client_custom_request_async.py new file mode 100644 index 000000000000..a34d5a982e26 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/async_samples/sample_index_client_custom_request_async.py @@ -0,0 +1,58 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to make custom HTTP requests using SearchIndexClient. + +USAGE: + python sample_index_client_custom_request_async.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the admin key for your search service +""" + + +async def sample_send_request_async(): + # [START sample_send_request_async] + import os + import sys + from pathlib import Path + from azure.core.credentials import AzureKeyCredential + from azure.core.rest import HttpRequest + from azure.search.documents.indexes.aio import SearchIndexClient + + sys.path.append(str(Path(__file__).resolve().parents[1])) + from sample_utils import AZURE_SEARCH_API_VERSION + + endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] + index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] + key = os.environ["AZURE_SEARCH_API_KEY"] + + index_client = SearchIndexClient(endpoint, AzureKeyCredential(key)) + + # The `send_request` method can send custom HTTP requests that share the client's existing pipeline, + # while adding convenience for endpoint construction. + request = HttpRequest( + method="GET", + url=f"/indexes('{index_name}')?api-version={AZURE_SEARCH_API_VERSION}", + ) + async with index_client: + response = await index_client.send_request(request) + response.raise_for_status() + response_body = response.json() + print(f"Response: {response_body}") + # [END sample_send_request_async] + + +if __name__ == "__main__": + import asyncio + + asyncio.run(sample_send_request_async()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_index_client_send_request_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_index_client_send_request_async.py deleted file mode 100644 index cd767d24f621..000000000000 --- a/sdk/search/azure-search-documents/samples/async_samples/sample_index_client_send_request_async.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_index_client_send_request_async.py - -DESCRIPTION: - This sample demonstrates how to make custom HTTP requests through a client pipeline. - -USAGE: - python sample_index_client_send_request_async.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import asyncio -import os -from azure.core.credentials import AzureKeyCredential -from azure.core.rest import HttpRequest -from azure.search.documents.indexes.aio import SearchIndexClient - - -async def sample_send_request(): - endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] - index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] - key = os.environ["AZURE_SEARCH_API_KEY"] - - client = SearchIndexClient(endpoint, AzureKeyCredential(key)) - - # The `send_request` method can send custom HTTP requests that share the client's existing pipeline, - # while adding convenience for endpoint construction. - request = HttpRequest(method="GET", url=f"/indexes('{index_name}')?api-version=2024-05-01-preview") - async with client: - response = await client.send_request(request) - response.raise_for_status() - response_body = response.json() - print(response_body) - - -if __name__ == "__main__": - asyncio.run(sample_send_request()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_index_crud_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_index_crud_async.py new file mode 100644 index 000000000000..f0bab5497144 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/async_samples/sample_index_crud_async.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to create, get, update, and delete a search index. + +USAGE: + python sample_index_crud_async.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_API_KEY - the admin key for your search service +""" + + +import os +import asyncio +from typing import List + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +key = os.environ["AZURE_SEARCH_API_KEY"] +index_name = "hotels-sample-index-index-crud" + + +async def create_index_async(): + # [START create_index_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexClient + from azure.search.documents.indexes.models import ( + ComplexField, + CorsOptions, + SearchIndex, + ScoringProfile, + SearchFieldDataType, + SimpleField, + SearchableField, + ) + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + fields = [ + SimpleField(name="HotelId", type=SearchFieldDataType.String, key=True), + SimpleField(name="HotelName", type=SearchFieldDataType.String, searchable=True), + SimpleField(name="BaseRate", type=SearchFieldDataType.Double), + SearchableField( + name="Description", type=SearchFieldDataType.String, collection=True + ), + ComplexField( + name="Address", + fields=[ + SimpleField(name="StreetAddress", type=SearchFieldDataType.String), + SimpleField(name="City", type=SearchFieldDataType.String), + ], + collection=True, + ), + ] + + cors_options = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60) + scoring_profiles: List[ScoringProfile] = [] + index = SearchIndex( + name=index_name, + fields=fields, + scoring_profiles=scoring_profiles, + cors_options=cors_options, + ) + + async with index_client: + result = await index_client.create_index(index) + print(f"Created: index '{result.name}'") + # [END create_index_async] + + +async def get_index_async(): + # [START get_index_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexClient + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + async with index_client: + result = await index_client.get_index(index_name) + print(f"Retrieved: index '{result.name}'") + # [END get_index_async] + + +async def update_index_async(): + # [START update_index_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexClient + from azure.search.documents.indexes.models import ( + ComplexField, + CorsOptions, + SearchIndex, + ScoringProfile, + SearchFieldDataType, + SimpleField, + SearchableField, + ) + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + fields = [ + SimpleField(name="HotelId", type=SearchFieldDataType.String, key=True), + SimpleField(name="HotelName", type=SearchFieldDataType.String, searchable=True), + SimpleField(name="BaseRate", type=SearchFieldDataType.Double), + SearchableField( + name="Description", type=SearchFieldDataType.String, collection=True + ), + ComplexField( + name="Address", + fields=[ + SimpleField(name="StreetAddress", type=SearchFieldDataType.String), + SimpleField(name="City", type=SearchFieldDataType.String), + SimpleField(name="State", type=SearchFieldDataType.String), + ], + collection=True, + ), + ] + + cors_options = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60) + scoring_profile = ScoringProfile(name="MyProfile") + scoring_profiles = [] + scoring_profiles.append(scoring_profile) + index = SearchIndex( + name=index_name, + fields=fields, + scoring_profiles=scoring_profiles, + cors_options=cors_options, + ) + + async with index_client: + result = await index_client.create_or_update_index(index=index) + print(f"Updated: index '{result.name}'") + # [END update_index_async] + + +async def delete_index_async(): + # [START delete_index_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexClient + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + async with index_client: + await index_client.delete_index(index_name) + print(f"Deleted: index '{index_name}'") + # [END delete_index_async] + + +if __name__ == "__main__": + asyncio.run(create_index_async()) + asyncio.run(get_index_async()) + asyncio.run(update_index_async()) + asyncio.run(delete_index_async()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_index_crud_operations_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_index_crud_operations_async.py deleted file mode 100644 index 8431867adfb0..000000000000 --- a/sdk/search/azure-search-documents/samples/async_samples/sample_index_crud_operations_async.py +++ /dev/null @@ -1,127 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_index_crud_operations_async.py -DESCRIPTION: - This sample demonstrates how to get, create, update, or delete an index. -USAGE: - python sample_index_crud_operations_async.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_API_KEY - your search API key -""" - - -import os -import asyncio -from typing import List - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -key = os.environ["AZURE_SEARCH_API_KEY"] - -from azure.core.credentials import AzureKeyCredential -from azure.search.documents.indexes.aio import SearchIndexClient -from azure.search.documents.indexes.models import ( - ComplexField, - CorsOptions, - SearchIndex, - ScoringProfile, - SearchFieldDataType, - SimpleField, - SearchableField, -) - - -async def create_index(): - # [START create_index_async] - client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - name = "hotels" - fields = [ - SimpleField(name="hotelId", type=SearchFieldDataType.String, key=True), - SimpleField(name="hotelName", type=SearchFieldDataType.String, searchable=True), - SimpleField(name="baseRate", type=SearchFieldDataType.Double), - SearchableField(name="description", type=SearchFieldDataType.String, collection=True), - ComplexField( - name="address", - fields=[ - SimpleField(name="streetAddress", type=SearchFieldDataType.String), - SimpleField(name="city", type=SearchFieldDataType.String), - ], - collection=True, - ), - ] - - cors_options = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60) - scoring_profiles: List[ScoringProfile] = [] - index = SearchIndex(name=name, fields=fields, scoring_profiles=scoring_profiles, cors_options=cors_options) - - result = await client.create_index(index) - await client.close() - # [END create_index_async] - - -async def get_index(): - # [START get_index_async] - client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - name = "hotels" - result = await client.get_index(name) - await client.close() - # [END get_index_async] - - -async def update_index(): - # [START update_index_async] - client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - name = "hotels" - fields = [ - SimpleField(name="hotelId", type=SearchFieldDataType.String, key=True), - SimpleField(name="hotelName", type=SearchFieldDataType.String, searchable=True), - SimpleField(name="baseRate", type=SearchFieldDataType.Double), - SearchableField(name="description", type=SearchFieldDataType.String, collection=True), - ComplexField( - name="address", - fields=[ - SimpleField(name="streetAddress", type=SearchFieldDataType.String), - SimpleField(name="city", type=SearchFieldDataType.String), - SimpleField(name="state", type=SearchFieldDataType.String), - ], - collection=True, - ), - ] - - cors_options = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60) - scoring_profile = ScoringProfile(name="MyProfile") - scoring_profiles = [] - scoring_profiles.append(scoring_profile) - index = SearchIndex(name=name, fields=fields, scoring_profiles=scoring_profiles, cors_options=cors_options) - - result = await client.create_or_update_index(index=index) - await client.close() - # [END update_index_async] - - -async def delete_index(): - # [START delete_index_async] - client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - name = "hotels" - await client.delete_index(name) - await client.close() - # [END delete_index_async] - - -async def main(): - await create_index() - await get_index() - await update_index() - await delete_index() - - -if __name__ == "__main__": - asyncio.run(main()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_index_synonym_map_crud_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_index_synonym_map_crud_async.py new file mode 100644 index 000000000000..e545d1197520 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/async_samples/sample_index_synonym_map_crud_async.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to create, get, update, and delete a synonym map. +USAGE: + python sample_index_synonym_map_crud_async.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + 2) AZURE_SEARCH_API_KEY - the primary admin key for your search service +""" + +import asyncio +import os +from pathlib import Path + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +key = os.environ["AZURE_SEARCH_API_KEY"] + +map1 = "hotels-sample-synonym-map" +map2 = "hotels-sample-synonym-map-file" +file_path = Path(__file__).resolve().parents[1] / "data" / "synonym_map.txt" + + +async def create_synonym_map_async(name): + # [START create_synonym_map_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexClient + from azure.search.documents.indexes.models import SynonymMap + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + synonyms = [ + "USA, United States, United States of America", + "Washington, Wash. => WA", + ] + synonym_map = SynonymMap(name=name, synonyms=synonyms) + async with index_client: + result = await index_client.create_synonym_map(synonym_map) + print(f"Created: synonym map '{result.name}'") + # [END create_synonym_map_async] + + +async def create_synonym_map_from_file_async(name): + # [START create_synonym_map_from_file_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexClient + from azure.search.documents.indexes.models import SynonymMap + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + with open(file_path, "r") as f: + solr_format_synonyms = f.read() + synonyms = solr_format_synonyms.split("\n") + synonym_map = SynonymMap(name=name, synonyms=synonyms) + async with index_client: + result = await index_client.create_synonym_map(synonym_map) + print(f"Created: synonym map '{result.name}'") + # [END create_synonym_map_from_file_async] + + +async def get_synonym_maps_async(): + # [START get_synonym_maps_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexClient + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + async with index_client: + result = await index_client.get_synonym_maps() + names = [x.name for x in result] + print(f"Synonym maps ({len(result)}): {', '.join(names)}") + # [END get_synonym_maps_async] + + +async def get_synonym_map_async(name): + # [START get_synonym_map_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexClient + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + async with index_client: + result = await index_client.get_synonym_map(name) + print(f"Retrieved: synonym map '{name}'") + if result: + for syn in result.synonyms: + print(f" {syn}") + # [END get_synonym_map_async] + + +async def delete_synonym_map_async(name): + # [START delete_synonym_map_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexClient + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + async with index_client: + await index_client.delete_synonym_map(name) + print(f"Deleted: synonym map '{name}'") + # [END delete_synonym_map_async] + + +if __name__ == "__main__": + asyncio.run(create_synonym_map_async(map1)) + asyncio.run(create_synonym_map_from_file_async(map2)) + asyncio.run(get_synonym_maps_async()) + asyncio.run(get_synonym_map_async(map1)) + asyncio.run(delete_synonym_map_async(map1)) + asyncio.run(delete_synonym_map_async(map2)) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_indexer_crud_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_indexer_crud_async.py new file mode 100644 index 000000000000..2f338e5e3989 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/async_samples/sample_indexer_crud_async.py @@ -0,0 +1,194 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to create, get, update, and delete an indexer. + +USAGE: + python sample_indexer_crud_async.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_API_KEY - the admin key for your search service + 3) AZURE_STORAGE_CONNECTION_STRING - connection string for the Azure Storage account +""" + +import asyncio +import os + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +key = os.environ["AZURE_SEARCH_API_KEY"] +connection_string = os.environ["AZURE_STORAGE_CONNECTION_STRING"] +container_name = "hotels-sample-container" +index_name = "hotels-sample-index-indexer-crud" +data_source_name = "hotels-sample-blob" +indexer_name = "hotels-sample-indexer-indexer-crud" + + +async def create_indexer_async(): + # [START create_indexer_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import ( + SearchIndexClient, + SearchIndexerClient, + ) + from azure.search.documents.indexes.models import ( + SearchIndexerDataContainer, + SearchIndexerDataSourceConnection, + SearchIndex, + SearchIndexer, + SimpleField, + SearchFieldDataType, + ) + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + # create an index + fields = [ + SimpleField(name="HotelId", type=SearchFieldDataType.String, key=True), + SimpleField(name="BaseRate", type=SearchFieldDataType.Double), + ] + index = SearchIndex(name=index_name, fields=fields) + async with index_client: + await index_client.create_index(index) + + # create a datasource + container = SearchIndexerDataContainer(name=container_name) + data_source_connection = SearchIndexerDataSourceConnection( + name=data_source_name, + type="azureblob", + connection_string=connection_string, + container=container, + ) + async with indexer_client: + await indexer_client.create_data_source_connection(data_source_connection) + + # create an indexer + indexer = SearchIndexer( + name=indexer_name, + data_source_name=data_source_name, + target_index_name=index_name, + ) + result = await indexer_client.create_indexer(indexer) + print(f"Created: indexer '{result.name}'") + # [END create_indexer_async] + + +async def list_indexers_async(): + # [START list_indexers_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexerClient + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + + async with indexer_client: + result = await indexer_client.get_indexers() + names = [x.name for x in result] + print(f"Indexers ({len(result)}): {', '.join(names)}") + # [END list_indexers_async] + + +async def get_indexer_async(): + # [START get_indexer_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexerClient + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + + async with indexer_client: + result = await indexer_client.get_indexer(indexer_name) + print(f"Retrieved: indexer '{result.name}'") + return result + # [END get_indexer_async] + + +async def get_indexer_status_async(): + # [START get_indexer_status_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexerClient + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + + async with indexer_client: + result = await indexer_client.get_indexer_status(indexer_name) + print(f"Status: indexer '{indexer_name}' is {result.status}") + return result + # [END get_indexer_status_async] + + +async def run_indexer_async(): + # [START run_indexer_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexerClient + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + + async with indexer_client: + await indexer_client.run_indexer(indexer_name) + print(f"Ran: indexer '{indexer_name}'") + # [END run_indexer_async] + return + + +async def reset_indexer_async(): + # [START reset_indexer_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexerClient + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + async with indexer_client: + await indexer_client.reset_indexer(indexer_name) + print(f"Reset: indexer '{indexer_name}'") + return + # [END reset_indexer_async] + + +async def delete_indexer_async(): + # [START delete_indexer_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexerClient + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + async with indexer_client: + await indexer_client.delete_indexer(indexer_name) + print(f"Deleted: indexer '{indexer_name}'") + # [END delete_indexer_async] + + +async def delete_data_source_async(): + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexerClient + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + async with indexer_client: + await indexer_client.delete_data_source_connection(data_source_name) + print(f"Deleted: data source '{data_source_name}'") + + +async def delete_index_async(): + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexClient + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + async with index_client: + await index_client.delete_index(index_name) + print(f"Deleted: index '{index_name}'") + + +if __name__ == "__main__": + asyncio.run(create_indexer_async()) + asyncio.run(list_indexers_async()) + asyncio.run(get_indexer_async()) + asyncio.run(get_indexer_status_async()) + asyncio.run(run_indexer_async()) + asyncio.run(reset_indexer_async()) + asyncio.run(delete_indexer_async()) + asyncio.run(delete_data_source_async()) + asyncio.run(delete_index_async()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_indexer_datasource_crud_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_indexer_datasource_crud_async.py new file mode 100644 index 000000000000..4a817dbe7309 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/async_samples/sample_indexer_datasource_crud_async.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to create, get, update, and delete a data source. + +USAGE: + python sample_indexer_datasource_crud_async.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_API_KEY - the admin key for your search service + 3) AZURE_STORAGE_CONNECTION_STRING - connection string for the Azure Storage account +""" + +import asyncio +import os + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +key = os.environ["AZURE_SEARCH_API_KEY"] +connection_string = os.environ["AZURE_STORAGE_CONNECTION_STRING"] +data_source_connection_name = "hotels-sample-blob" +container_name = "hotels-sample-container" + + +async def create_data_source_connection_async(): + # [START create_data_source_connection_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexerClient + from azure.search.documents.indexes.models import ( + SearchIndexerDataContainer, + SearchIndexerDataSourceConnection, + ) + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + + container = SearchIndexerDataContainer(name=container_name) + data_source_connection = SearchIndexerDataSourceConnection( + name=data_source_connection_name, + type="azureblob", + connection_string=connection_string, + container=container, + ) + async with indexer_client: + result = await indexer_client.create_data_source_connection( + data_source_connection + ) + print(f"Created: data source '{result.name}'") + # [END create_data_source_connection_async] + + +async def list_data_source_connections_async(): + # [START list_data_source_connections_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexerClient + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + + async with indexer_client: + result = await indexer_client.get_data_source_connections() + names = [ds.name for ds in result] + print(f"Data sources ({len(result)}): {', '.join(names)}") + # [END list_data_source_connections_async] + + +async def get_data_source_connection_async(): + # [START get_data_source_connection_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexerClient + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + + async with indexer_client: + result = await indexer_client.get_data_source_connection( + data_source_connection_name + ) + print(f"Retrieved: data source '{result.name}'") + return result + # [END get_data_source_connection_async] + + +async def delete_data_source_connection_async(): + # [START delete_data_source_connection_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexerClient + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + + async with indexer_client: + await indexer_client.delete_data_source_connection(data_source_connection_name) + print(f"Deleted: data source '{data_source_connection_name}'") + # [END delete_data_source_connection_async] + + +if __name__ == "__main__": + asyncio.run(create_data_source_connection_async()) + asyncio.run(list_data_source_connections_async()) + asyncio.run(get_data_source_connection_async()) + asyncio.run(delete_data_source_connection_async()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_indexers_operations_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_indexers_operations_async.py deleted file mode 100644 index e83e1bbc66c3..000000000000 --- a/sdk/search/azure-search-documents/samples/async_samples/sample_indexers_operations_async.py +++ /dev/null @@ -1,132 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_indexer_operations_async.py -DESCRIPTION: - This sample demonstrates how to get, create, update, or delete a Indexer. -USAGE: - python sample_indexer_operations_async.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_API_KEY - your search API key -""" - -import asyncio -import os - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -key = os.environ["AZURE_SEARCH_API_KEY"] -connection_string = os.environ["AZURE_STORAGE_CONNECTION_STRING"] - -from azure.core.credentials import AzureKeyCredential -from azure.search.documents.indexes.models import ( - SearchIndexerDataContainer, - SearchIndexerDataSourceConnection, - SearchIndex, - SearchIndexer, - SimpleField, - SearchFieldDataType, -) -from azure.search.documents.indexes.aio import SearchIndexerClient, SearchIndexClient - -indexers_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) - - -async def create_indexer(): - # create an index - index_name = "async-indexer-hotels" - fields = [ - SimpleField(name="hotelId", type=SearchFieldDataType.String, key=True), - SimpleField(name="baseRate", type=SearchFieldDataType.Double), - ] - index = SearchIndex(name=index_name, fields=fields) - ind_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - async with ind_client: - await ind_client.create_index(index) - - # [START create_indexer_async] - # create a datasource - container = SearchIndexerDataContainer(name="searchcontainer") - data_source_connection = SearchIndexerDataSourceConnection( - name="async-indexer-datasource", type="azureblob", connection_string=connection_string, container=container - ) - data_source = await indexers_client.create_data_source_connection(data_source_connection) - - # create an indexer - indexer = SearchIndexer( - name="async-sample-indexer", - data_source_name="async-indexer-datasource", - target_index_name="async-indexer-hotels", - ) - result = await indexers_client.create_indexer(indexer) - print("Create new Indexer - async-sample-indexer") - # [END create_indexer_async] - - -async def list_indexers(): - # [START list_indexer_async] - result = await indexers_client.get_indexers() - names = [x.name for x in result] - print("Found {} Indexers in the service: {}".format(len(result), ", ".join(names))) - # [END list_indexer_async] - - -async def get_indexer(): - # [START get_indexer_async] - result = await indexers_client.get_indexer("async-sample-indexer") - print("Retrived Indexer 'async-sample-indexer'") - return result - # [END get_indexer_async] - - -async def get_indexer_status(): - # [START get_indexer_status_async] - result = await indexers_client.get_indexer_status("async-sample-indexer") - print("Retrived Indexer status for 'async-sample-indexer'") - return result - # [END get_indexer_status_async] - - -async def run_indexer(): - # [START run_indexer_async] - await indexers_client.run_indexer("async-sample-indexer") - print("Ran the Indexer 'async-sample-indexer'") - return - # [END run_indexer_async] - - -async def reset_indexer(): - # [START reset_indexer_async] - await indexers_client.reset_indexer("async-sample-indexer") - print("Reset the Indexer 'async-sample-indexer'") - return - # [END reset_indexer_async] - - -async def delete_indexer(): - # [START delete_indexer_async] - await indexers_client.delete_indexer("async-sample-indexer") - print("Indexer 'async-sample-indexer' successfully deleted") - # [END delete_indexer_async] - - -async def main(): - await create_indexer() - await list_indexers() - await get_indexer() - await get_indexer_status() - await run_indexer() - await reset_indexer() - await delete_indexer() - await indexers_client.close() - - -if __name__ == "__main__": - asyncio.run(main()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_query_autocomplete_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_query_autocomplete_async.py new file mode 100644 index 000000000000..70b3eb5d5121 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/async_samples/sample_query_autocomplete_async.py @@ -0,0 +1,50 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to retrieve autocomplete suggestions. + +USAGE: + python sample_query_autocomplete_async.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the admin key for your search service +""" + +import os +import asyncio + + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] + + +async def autocomplete_query_async(): + # [START autocomplete_query_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.aio import SearchClient + + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + async with search_client: + results = await search_client.autocomplete( + search_text="bo", suggester_name="sg" + ) + + print("Results: autocomplete for 'bo'") + for result in results: + print(f" Completion: {result['text']}") + # [END autocomplete_query_async] + + +if __name__ == "__main__": + asyncio.run(autocomplete_query_async()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_query_facets_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_query_facets_async.py new file mode 100644 index 000000000000..5dacbf5b2a8b --- /dev/null +++ b/sdk/search/azure-search-documents/samples/async_samples/sample_query_facets_async.py @@ -0,0 +1,53 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to retrieve facets in search results. + +USAGE: + python sample_query_facets_async.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the admin key for your search service +""" + +import os +import asyncio + + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] + + +async def facet_query_async(): + # [START facet_query_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.aio import SearchClient + + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + async with search_client: + results = await search_client.search( + search_text="WiFi", facets=["Category,count:3", "ParkingIncluded"] + ) + + facets = await results.get_facets() + + print("Results: category facets") + if facets: + for facet in facets["Category"]: + print(f" {facet}") + # [END facet_query_async] + + +if __name__ == "__main__": + asyncio.run(facet_query_async()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_query_filter_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_query_filter_async.py new file mode 100644 index 000000000000..4083b2446be1 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/async_samples/sample_query_filter_async.py @@ -0,0 +1,53 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to filter and sort search results. + +USAGE: + python sample_query_filter_async.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the admin key for your search service +""" + +import os +import asyncio + + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] + + +async def filter_query_async(): + # [START filter_query_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.aio import SearchClient + + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + async with search_client: + results = await search_client.search( + search_text="WiFi", + filter="Address/StateProvince eq 'FL' and Address/Country eq 'USA'", + select=["HotelName", "Rating"], + order_by=["Rating desc"], + ) + + print("Results: Florida hotels with WiFi (sorted by rating)") + async for result in results: + print(f" HotelName: {result['HotelName']} (rating {result['Rating']})") + # [END filter_query_async] + + +if __name__ == "__main__": + asyncio.run(filter_query_async()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_query_semantic_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_query_semantic_async.py new file mode 100644 index 000000000000..e8ac4c536b04 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/async_samples/sample_query_semantic_async.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to perform semantic search. +USAGE: + python sample_query_semantic_async.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the primary admin key for your search service +""" + +import os +import asyncio + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] +semantic_configuration_name = "hotels-sample-semantic-config" + + +async def create_semantic_configuration_async(): + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexClient + from azure.search.documents.indexes.models import ( + SemanticConfiguration, + SemanticPrioritizedFields, + SemanticField, + SemanticSearch, + ) + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + async with index_client: + index = await index_client.get_index(index_name) + + semantic_config = SemanticConfiguration( + name=semantic_configuration_name, + prioritized_fields=SemanticPrioritizedFields( + title_field=SemanticField(field_name="HotelName"), + content_fields=[SemanticField(field_name="Description")], + keywords_fields=[SemanticField(field_name="Tags")], + ), + ) + + index.semantic_search = SemanticSearch(configurations=[semantic_config]) + await index_client.create_or_update_index(index) + print( + f"Updated: index '{index_name}' (semantic config '{semantic_configuration_name}')" + ) + + +async def speller_async(): + # [START speller_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.aio import SearchClient + + credential = AzureKeyCredential(key) + search_client = SearchClient( + endpoint=service_endpoint, index_name=index_name, credential=credential + ) + async with search_client: + results = await search_client.search( + search_text="luxury", query_language="en-us", query_speller="lexicon" + ) + + print("Results: speller") + async for result in results: + print(f" HotelId: {result['HotelId']}") + print(f" HotelName: {result['HotelName']}") + # [END speller_async] + + +async def semantic_ranking_async(): + # [START semantic_ranking_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.aio import SearchClient + + credential = AzureKeyCredential(key) + search_client = SearchClient( + endpoint=service_endpoint, index_name=index_name, credential=credential + ) + async with search_client: + results = await search_client.search( + search_text="luxury", + query_type="semantic", + semantic_configuration_name=semantic_configuration_name, + query_language="en-us", + ) + + print("Results: semantic ranking") + async for result in results: + print(f" HotelId: {result['HotelId']}") + print(f" HotelName: {result['HotelName']}") + # [END semantic_ranking_async] + + +async def delete_semantic_configuration_async(): + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexClient + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + async with index_client: + index = await index_client.get_index(index_name) + index.semantic_search = None + await index_client.create_or_update_index(index) + print(f"Deleted: semantic config from index '{index_name}'") + + +if __name__ == "__main__": + asyncio.run(create_semantic_configuration_async()) + asyncio.run(speller_async()) + asyncio.run(semantic_ranking_async()) + asyncio.run(delete_semantic_configuration_async()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_query_session_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_query_session_async.py index bfd02c0b6e27..3dc5c1e861e9 100644 --- a/sdk/search/azure-search-documents/samples/async_samples/sample_query_session_async.py +++ b/sdk/search/azure-search-documents/samples/async_samples/sample_query_session_async.py @@ -1,24 +1,20 @@ # coding: utf-8 # ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. # -------------------------------------------------------------------------- """ -FILE: sample_query_session_async.py DESCRIPTION: - To ensure more consistent and unique search results within a user's session, you can use session id. - Simply include the session_id parameter in your queries to create a unique identifier for each user session. - This ensures a uniform experience for users throughout their "query session". + Demonstrates how to use session IDs for consistent scoring. USAGE: python sample_query_session_async.py - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the primary admin key for your search service """ import os @@ -29,7 +25,7 @@ key = os.environ["AZURE_SEARCH_API_KEY"] -async def query_session(): +async def query_session_async(): # [START query_session_async] from azure.core.credentials import AzureKeyCredential from azure.search.documents.aio import SearchClient @@ -39,11 +35,11 @@ async def query_session(): async with search_client: results = await search_client.search(search_text="spa", session_id="session-1") - print("Hotels containing 'spa' in the name (or other fields):") + print("Results: hotels with 'spa'") async for result in results: - print(" Name: {} (rating {})".format(result["hotelName"], result["rating"])) + print(f" HotelName: {result['HotelName']} (rating {result['Rating']})") # [END query_session_async] if __name__ == "__main__": - asyncio.run(query_session()) + asyncio.run(query_session_async()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_query_simple_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_query_simple_async.py new file mode 100644 index 000000000000..8bc4efba8373 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/async_samples/sample_query_simple_async.py @@ -0,0 +1,46 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to perform a simple text search. +USAGE: + python sample_query_simple_async.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the primary admin key for your search service +""" + +import os +import asyncio + + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] + + +async def simple_query_async(): + # [START simple_query_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.aio import SearchClient + + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + async with search_client: + results = await search_client.search(search_text="spa") + + print("Results: hotels with 'spa'") + async for result in results: + print(f" HotelName: {result['HotelName']} (rating {result['Rating']})") + # [END simple_query_async] + + +if __name__ == "__main__": + asyncio.run(simple_query_async()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_suggestions_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_query_suggestions_async.py similarity index 51% rename from sdk/search/azure-search-documents/samples/async_samples/sample_suggestions_async.py rename to sdk/search/azure-search-documents/samples/async_samples/sample_query_suggestions_async.py index 8f3fef5a90af..cc70c799b77c 100644 --- a/sdk/search/azure-search-documents/samples/async_samples/sample_suggestions_async.py +++ b/sdk/search/azure-search-documents/samples/async_samples/sample_query_suggestions_async.py @@ -1,23 +1,20 @@ # coding: utf-8 # ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. # -------------------------------------------------------------------------- """ -FILE: sample_suggestions_async.py DESCRIPTION: - This sample demonstrates how to obtain search suggestions from an Azure - search index. + Demonstrates how to retrieve search suggestions. USAGE: - python sample_suggestions_async.py + python sample_query_suggestions_async.py - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the primary admin key for your search service """ import os @@ -29,7 +26,7 @@ key = os.environ["AZURE_SEARCH_API_KEY"] -async def suggest_query(): +async def suggest_query_async(): # [START suggest_query_async] from azure.core.credentials import AzureKeyCredential from azure.search.documents.aio import SearchClient @@ -39,12 +36,12 @@ async def suggest_query(): async with search_client: results = await search_client.suggest(search_text="coffee", suggester_name="sg") - print("Search suggestions for 'coffee'") + print("Results: suggestions for 'coffee'") for result in results: - hotel = await search_client.get_document(key=result["hotelId"]) - print(" Text: {} for Hotel: {}".format(repr(result["text"]), hotel["hotelName"])) + hotel = await search_client.get_document(key=result["HotelId"]) + print(f" Text: {result['text']!r}, HotelName: {hotel['HotelName']}") # [END suggest_query_async] if __name__ == "__main__": - asyncio.run(suggest_query()) + asyncio.run(suggest_query_async()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_query_vector_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_query_vector_async.py new file mode 100644 index 000000000000..0f742646e0f7 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/async_samples/sample_query_vector_async.py @@ -0,0 +1,272 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to create a vector-enabled index, upload documents with + pre-computed DescriptionVector values, and run vector queries. + +USAGE: + python sample_query_vector_async.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + 2) AZURE_SEARCH_API_KEY - the primary admin key for your search service + +NOTE: + This sample uses a pre-computed vector for the query "quintessential lodging + near running trails, eateries, retail" instead of calling an embedding API. + The vector was generated using text-embedding-ada-002 (1536 dimensions). +""" + +import asyncio +import json +import os +from pathlib import Path + +from azure.core.credentials import AzureKeyCredential +from azure.search.documents.aio import SearchClient +from azure.search.documents.models import VectorizedQuery +from azure.search.documents.indexes.aio import SearchIndexClient +from azure.search.documents.indexes.models import ( + SimpleField, + SearchField, + SearchFieldDataType, + SearchableField, + SearchIndex, + SemanticConfiguration, + SemanticField, + SemanticPrioritizedFields, + SemanticSearch, + VectorSearch, + VectorSearchProfile, + HnswAlgorithmConfiguration, + ExhaustiveKnnAlgorithmConfiguration, +) + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +key = os.environ["AZURE_SEARCH_API_KEY"] + +index_name = "hotels-sample-index-query-vector" + +data_dir = Path(__file__).resolve().parents[1] / "data" +documents_path = data_dir / "hotels_with_description_vector.json" +query_vector_path = data_dir / "query_vector.json" + + +def load_query_vector(query_vector_path): + """Load the query vector from the samples/data folder.""" + with open(query_vector_path, "r", encoding="utf-8") as handle: + return json.load(handle) + + +vector = load_query_vector(query_vector_path) + + +async def create_index_async(): + """Create or update the vector-enabled search index.""" + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + fields = [ + SimpleField( + name="HotelId", type=SearchFieldDataType.String, key=True, filterable=True + ), + SearchableField( + name="HotelName", type=SearchFieldDataType.String, sortable=True + ), + SearchableField(name="Description", type=SearchFieldDataType.String), + SearchField( + name="DescriptionVector", + type=SearchFieldDataType.Collection(SearchFieldDataType.Single), + searchable=True, + vector_search_dimensions=1536, + vector_search_profile_name="my-vector-profile", + ), + SearchableField( + name="Category", + type=SearchFieldDataType.String, + sortable=True, + filterable=True, + facetable=True, + ), + SearchField( + name="Tags", + type=SearchFieldDataType.Collection(SearchFieldDataType.String), + searchable=True, + filterable=True, + facetable=True, + ), + ] + + vector_search = VectorSearch( + algorithms=[ + HnswAlgorithmConfiguration(name="my-hnsw-vector-config-1", kind="hnsw"), + ExhaustiveKnnAlgorithmConfiguration( + name="my-eknn-vector-config", kind="exhaustiveKnn" + ), + ], + profiles=[ + VectorSearchProfile( + name="my-vector-profile", + algorithm_configuration_name="my-hnsw-vector-config-1", + ) + ], + ) + + semantic_config = SemanticConfiguration( + name="my-semantic-config", + prioritized_fields=SemanticPrioritizedFields( + title_field=SemanticField(field_name="HotelName"), + content_fields=[SemanticField(field_name="Description")], + keywords_fields=[SemanticField(field_name="Category")], + ), + ) + + semantic_search = SemanticSearch(configurations=[semantic_config]) + + index = SearchIndex( + name=index_name, + fields=fields, + vector_search=vector_search, + semantic_search=semantic_search, + ) + + async with index_client: + result = await index_client.create_or_update_index(index) + print(f"Created: index '{result.name}'") + + +def load_documents(): + with open(documents_path, "r", encoding="utf-8") as handle: + raw = handle.read().strip() + + payload = json.loads(raw) + documents = payload["value"] + + return documents + + +async def upload_documents_async(): + """Upload documents to the search index.""" + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + documents = load_documents() + async with search_client: + result = await search_client.upload_documents(documents=documents) + print(f"Uploaded: {len(result)} documents to index '{index_name}'") + + +async def single_vector_search_async(): + """Perform a single vector search using a pre-computed query vector.""" + # [START single_vector_search_async] + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + vector_query = VectorizedQuery( + vector=vector, + k=5, + fields="DescriptionVector", + ) + + async with search_client: + results = await search_client.search( + vector_queries=[vector_query], + select=["HotelId", "HotelName", "Description", "Category", "Tags"], + top=5, + ) + + print("Results: single vector search") + async for result in results: + print( + f" HotelId: {result['HotelId']}, HotelName: {result['HotelName']}, " + f"Category: {result.get('Category')}" + ) + # [END single_vector_search_async] + + +async def single_vector_search_with_filter_async(): + """Perform a vector search with a filter applied.""" + # [START single_vector_search_with_filter_async] + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + vector_query = VectorizedQuery( + vector=vector, + k=5, + fields="DescriptionVector", + ) + + async with search_client: + results = await search_client.search( + vector_queries=[vector_query], + filter="Tags/any(tag: tag eq 'free wifi')", + select=["HotelId", "HotelName", "Description", "Category", "Tags"], + top=5, + ) + + print("Results: vector search with filter") + async for result in results: + print( + f" HotelId: {result['HotelId']}, HotelName: {result['HotelName']}, " + f"Tags: {result.get('Tags')}" + ) + # [END single_vector_search_with_filter_async] + + +async def simple_hybrid_search_async(): + """Perform a hybrid search combining vector and text search.""" + # [START simple_hybrid_search_async] + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + vector_query = VectorizedQuery( + vector=vector, + k=5, + fields="DescriptionVector", + ) + + async with search_client: + results = await search_client.search( + search_text="historic hotel walk to restaurants and shopping", + vector_queries=[vector_query], + select=["HotelId", "HotelName", "Description", "Category", "Tags"], + top=5, + ) + + print("Results: hybrid search") + async for result in results: + score = result.get("@search.score", "N/A") + print(f" Score: {score}") + print(f" HotelId: {result['HotelId']}") + print(f" HotelName: {result['HotelName']}") + print(f" Description: {result.get('Description')}") + print(f" Category: {result.get('Category')}") + print(f" Tags: {result.get('Tags', 'N/A')}") + print() + # [END simple_hybrid_search_async] + + +async def delete_index_async(): + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + async with index_client: + await index_client.delete_index(index_name) + print(f"Deleted: index '{index_name}'") + + +if __name__ == "__main__": + print("Query: 'quintessential lodging near running trails, eateries, retail'") + + async def run(): + try: + await create_index_async() + await upload_documents_async() + await single_vector_search_async() + print() + await single_vector_search_with_filter_async() + print() + await simple_hybrid_search_async() + print() + finally: + await delete_index_async() + + asyncio.run(run()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_search_client_custom_request_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_search_client_custom_request_async.py new file mode 100644 index 000000000000..24fe1a28be00 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/async_samples/sample_search_client_custom_request_async.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to make custom HTTP requests using SearchClient. + +USAGE: + python sample_search_client_custom_request_async.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the primary admin key for your search service +""" + +import asyncio +import os + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] + + +async def sample_send_request_async(): + from azure.core.credentials import AzureKeyCredential + from azure.core.rest import HttpRequest + from azure.search.documents.aio import SearchClient + import sys + from pathlib import Path + + sys.path.append(str(Path(__file__).resolve().parents[1])) + from sample_utils import AZURE_SEARCH_API_VERSION + + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + # The `send_request` method can send custom HTTP requests that share the client's existing pipeline, + # while adding convenience for endpoint construction. + request = HttpRequest( + method="GET", url=f"/docs/$count?api-version={AZURE_SEARCH_API_VERSION}" + ) + async with search_client: + response = await search_client.send_request(request) + response.raise_for_status() + response_body = response.json() + print(f"Document count: {response_body} (index '{index_name}')") + + +if __name__ == "__main__": + asyncio.run(sample_send_request_async()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_search_client_send_request_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_search_client_send_request_async.py deleted file mode 100644 index 3a9c0c13d185..000000000000 --- a/sdk/search/azure-search-documents/samples/async_samples/sample_search_client_send_request_async.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_search_client_send_request_async.py - -DESCRIPTION: - This sample demonstrates how to make custom HTTP requests through a client pipeline. - -USAGE: - python sample_search_client_send_request_async.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import asyncio -import os -from azure.core.credentials import AzureKeyCredential -from azure.core.rest import HttpRequest -from azure.search.documents.aio import SearchClient - - -async def sample_send_request(): - endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] - index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] - key = os.environ["AZURE_SEARCH_API_KEY"] - - client = SearchClient(endpoint, index_name, AzureKeyCredential(key)) - - # The `send_request` method can send custom HTTP requests that share the client's existing pipeline, - # while adding convenience for endpoint construction. - request = HttpRequest(method="GET", url=f"/docs/$count?api-version=2024-05-01-preview") - async with client: - response = await client.send_request(request) - response.raise_for_status() - response_body = response.json() - print(response_body) - - -if __name__ == "__main__": - asyncio.run(sample_send_request()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_semantic_search_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_semantic_search_async.py deleted file mode 100644 index 42a0cb2874ee..000000000000 --- a/sdk/search/azure-search-documents/samples/async_samples/sample_semantic_search_async.py +++ /dev/null @@ -1,71 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_semantic_search_async.py -DESCRIPTION: - This sample demonstrates how to use semantic search. -USAGE: - python sample_semantic_search_async.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import os -import asyncio - - -async def speller(): - # [START speller_async] - from azure.core.credentials import AzureKeyCredential - from azure.search.documents.aio import SearchClient - - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] - index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] - key = os.environ["AZURE_SEARCH_API_KEY"] - - credential = AzureKeyCredential(key) - client = SearchClient(endpoint=service_endpoint, index_name=index_name, credential=credential) - results = await client.search(search_text="luxury", query_language="en-us", query_speller="lexicon") - - async for result in results: - print("{}\n{}\n)".format(result["hotelId"], result["hotelName"])) - # [END speller_async] - - -async def semantic_ranking(): - # [START semantic_ranking_async] - from azure.core.credentials import AzureKeyCredential - from azure.search.documents import SearchClient - - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] - index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] - key = os.environ["AZURE_SEARCH_API_KEY"] - - credential = AzureKeyCredential(key) - client = SearchClient(endpoint=service_endpoint, index_name=index_name, credential=credential) - results = list( - client.search( - search_text="luxury", - query_type="semantic", - semantic_configuration_name="semantic_config_name", - query_language="en-us", - ) - ) - - for result in results: - print("{}\n{}\n)".format(result["hotelId"], result["hotelName"])) - # [END semantic_ranking_async] - - -if __name__ == "__main__": - asyncio.run(speller()) - asyncio.run(semantic_ranking()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_simple_query_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_simple_query_async.py deleted file mode 100644 index d5f62acb4ff6..000000000000 --- a/sdk/search/azure-search-documents/samples/async_samples/sample_simple_query_async.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_simple_query_async.py -DESCRIPTION: - This sample demonstrates how to get search results from a basic search text - from an Azure Search index. -USAGE: - python sample_simple_query_async.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import os -import asyncio - - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] -key = os.environ["AZURE_SEARCH_API_KEY"] - - -async def simple_text_query(): - # [START simple_query_async] - from azure.core.credentials import AzureKeyCredential - from azure.search.documents.aio import SearchClient - - search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) - - async with search_client: - results = await search_client.search(search_text="spa") - - print("Hotels containing 'spa' in the name (or other fields):") - async for result in results: - print(" Name: {} (rating {})".format(result["hotelName"], result["rating"])) - # [END simple_query_async] - - -if __name__ == "__main__": - asyncio.run(simple_text_query()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_synonym_map_operations_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_synonym_map_operations_async.py deleted file mode 100644 index d45d375563d9..000000000000 --- a/sdk/search/azure-search-documents/samples/async_samples/sample_synonym_map_operations_async.py +++ /dev/null @@ -1,80 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_synonym_map_operations_async.py -DESCRIPTION: - This sample demonstrates how to get, create, update, or delete a Synonym Map. -USAGE: - python sample_synonym_map_operations_async.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_API_KEY - your search API key -""" - -import asyncio -import os - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -key = os.environ["AZURE_SEARCH_API_KEY"] - -from azure.core.credentials import AzureKeyCredential -from azure.search.documents.indexes.aio import SearchIndexClient -from azure.search.documents.indexes.models import SynonymMap - -client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - - -async def create_synonym_map(): - # [START create_synonym_map_async] - synonyms = [ - "USA, United States, United States of America", - "Washington, Wash. => WA", - ] - synonym_map = SynonymMap(name="test-syn-map", synonyms=synonyms) - result = await client.create_synonym_map(synonym_map) - print("Create new Synonym Map 'test-syn-map succeeded") - # [END create_synonym_map_async] - - -async def get_synonym_maps(): - # [START get_synonym_maps_async] - result = await client.get_synonym_maps() - names = [x.name for x in result] - print("Found {} Synonym Maps in the service: {}".format(len(result), ", ".join(names))) - # [END get_synonym_maps_async] - - -async def get_synonym_map(): - # [START get_synonym_map_async] - result = await client.get_synonym_map("test-syn-map") - print("Retrived Synonym Map 'test-syn-map' with synonyms") - if result: - for syn in result.synonyms: - print(" {}".format(syn)) - # [END get_synonym_map_async] - - -async def delete_synonym_map(): - # [START delete_synonym_map_async] - await client.delete_synonym_map("test-syn-map") - print("Synonym Map 'test-syn-map' deleted") - # [END delete_synonym_map_async] - - -async def main(): - await create_synonym_map() - await get_synonym_maps() - await get_synonym_map() - await delete_synonym_map() - await client.close() - - -if __name__ == "__main__": - asyncio.run(main()) diff --git a/sdk/search/azure-search-documents/samples/async_samples/sample_vector_search_async.py b/sdk/search/azure-search-documents/samples/async_samples/sample_vector_search_async.py deleted file mode 100644 index 269226f313d6..000000000000 --- a/sdk/search/azure-search-documents/samples/async_samples/sample_vector_search_async.py +++ /dev/null @@ -1,203 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_vector_search_async.py -DESCRIPTION: - This sample demonstrates how to get search results from a basic search text - from an Azure Search index. -USAGE: - python sample_vector_search_async.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import os -import asyncio - -from azure.core.credentials import AzureKeyCredential -from azure.search.documents.aio import SearchClient -from azure.search.documents.indexes import SearchIndexClient -from azure.search.documents.models import VectorizedQuery - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] -key = os.environ["AZURE_SEARCH_API_KEY"] - - -def get_embeddings(text: str): - # There are a few ways to get embeddings. This is just one example. - import openai - - open_ai_endpoint = os.getenv("OpenAIEndpoint") - open_ai_key = os.getenv("OpenAIKey") - - client = openai.AzureOpenAI( - azure_endpoint=open_ai_endpoint, - api_key=open_ai_key, - api_version="2023-09-01-preview", - ) - embedding = client.embeddings.create(input=[text], model="text-embedding-ada-002") - return embedding.data[0].embedding - - -def get_hotel_index(name: str): - from azure.search.documents.indexes.models import ( - SearchIndex, - SearchField, - SearchFieldDataType, - SimpleField, - SearchableField, - VectorSearch, - VectorSearchProfile, - HnswAlgorithmConfiguration, - ) - - fields = [ - SimpleField(name="hotelId", type=SearchFieldDataType.String, key=True), - SearchableField(name="hotelName", type=SearchFieldDataType.String, sortable=True, filterable=True), - SearchableField(name="description", type=SearchFieldDataType.String), - SearchField( - name="descriptionVector", - type=SearchFieldDataType.Collection(SearchFieldDataType.Single), - searchable=True, - vector_search_dimensions=1536, - vector_search_profile_name="my-vector-config", - ), - SearchableField( - name="category", type=SearchFieldDataType.String, sortable=True, filterable=True, facetable=True - ), - ] - vector_search = VectorSearch( - profiles=[VectorSearchProfile(name="my-vector-config", algorithm_configuration_name="my-algorithms-config")], - algorithms=[HnswAlgorithmConfiguration(name="my-algorithms-config")], - ) - return SearchIndex(name=name, fields=fields, vector_search=vector_search) - - -def get_hotel_documents(): - docs = [ - { - "hotelId": "1", - "hotelName": "Fancy Stay", - "description": "Best hotel in town if you like luxury hotels.", - "descriptionVector": get_embeddings("Best hotel in town if you like luxury hotels."), - "category": "Luxury", - }, - { - "hotelId": "2", - "hotelName": "Roach Motel", - "description": "Cheapest hotel in town. Infact, a motel.", - "descriptionVector": get_embeddings("Cheapest hotel in town. Infact, a motel."), - "category": "Budget", - }, - { - "hotelId": "3", - "hotelName": "EconoStay", - "description": "Very popular hotel in town.", - "descriptionVector": get_embeddings("Very popular hotel in town."), - "category": "Budget", - }, - { - "hotelId": "4", - "hotelName": "Modern Stay", - "description": "Modern architecture, very polite staff and very clean. Also very affordable.", - "descriptionVector": get_embeddings( - "Modern architecture, very polite staff and very clean. Also very affordable." - ), - "category": "Luxury", - }, - { - "hotelId": "5", - "hotelName": "Secret Point", - "description": "One of the best hotel in town. The hotel is ideally located on the main commercial artery of the city in the heart of New York.", - "descriptionVector": get_embeddings( - "One of the best hotel in town. The hotel is ideally located on the main commercial artery of the city in the heart of New York." - ), - "category": "Boutique", - }, - ] - return docs - - -async def single_vector_search(): - # [START single_vector_search] - query = "Top hotels in town" - - search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) - vector_query = VectorizedQuery(vector=get_embeddings(query), k_nearest_neighbors=3, fields="descriptionVector") - - async with search_client: - results = await search_client.search( - search_text="", - vector_queries=[vector_query], - select=["hotelId", "hotelName"], - ) - - async for result in results: - print(result) - # [END single_vector_search] - - -async def single_vector_search_with_filter(): - # [START single_vector_search_with_filter] - query = "Top hotels in town" - - search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) - vector_query = VectorizedQuery(vector=get_embeddings(query), k_nearest_neighbors=3, fields="descriptionVector") - - async with search_client: - results = await search_client.search( - vector_queries=[vector_query], - filter="category eq 'Luxury'", - select=["hotelId", "hotelName"], - ) - - async for result in results: - print(result) - # [END single_vector_search_with_filter] - - -async def simple_hybrid_search(): - # [START simple_hybrid_search] - query = "Top hotels in town" - - search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) - vector_query = VectorizedQuery(vector=get_embeddings(query), k_nearest_neighbors=3, fields="descriptionVector") - - async with search_client: - results = await search_client.search( - search_text=query, - vector_queries=[vector_query], - select=["hotelId", "hotelName"], - ) - - async for result in results: - print(result) - # [END simple_hybrid_search] - - -async def main(): - credential = AzureKeyCredential(key) - index_client = SearchIndexClient(service_endpoint, credential) - index = get_hotel_index(index_name) - index_client.create_index(index) - client = SearchClient(service_endpoint, index_name, credential) - hotel_docs = get_hotel_documents() - await client.upload_documents(documents=hotel_docs) - - await single_vector_search() - await single_vector_search_with_filter() - await simple_hybrid_search() - - -if __name__ == "__main__": - asyncio.run(main()) diff --git a/sdk/search/azure-search-documents/samples/data/hotels_with_description_vector.json b/sdk/search/azure-search-documents/samples/data/hotels_with_description_vector.json new file mode 100644 index 000000000000..c2498e5494d4 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/data/hotels_with_description_vector.json @@ -0,0 +1,10855 @@ +{ + "value": [ + { + "@search.action": "mergeOrUpload", + "HotelId": "1", + "HotelName": "Stay-Kay City Hotel", + "Description": "This classic hotel is fully-refurbished and ideally located on the main commercial artery of the city in the heart of New York. A few minutes away is Times Square and the historic centre of the city, as well as other places of interest that make New York one of America's most attractive and cosmopolitan cities.", + "DescriptionVector": [ + -0.048865054, + -0.020307425, + 0.017633565, + 0.023875887, + -0.04401433, + -0.021689085, + -0.04437217, + 0.011500583, + 0.03840817, + 0.00029058976, + 0.016907945, + -0.009214383, + -0.04512761, + 0.019889945, + 0.020973407, + 0.023040926, + -0.026539808, + 0.050495215, + 0.07152826, + -0.008786962, + -0.009994673, + -0.0053129313, + -0.014601864, + -0.048069853, + 0.021231845, + 0.022066806, + -0.018021226, + -0.010526463, + 0.07220418, + 0.0068685417, + 0.009472823, + -0.023239726, + 0.040276892, + 0.03399481, + 0.0156058045, + -0.001837658, + -0.009567252, + -0.03630089, + 0.009010613, + 0.027672967, + -0.023398766, + 0.030078448, + 0.018428765, + -0.006709502, + -0.03598281, + -0.018021226, + -0.017782666, + 0.06655826, + -0.019909825, + 0.010963823, + -0.028428407, + 0.007325782, + -0.030833889, + -0.045724012, + -0.0780489, + 0.024253607, + 0.018220024, + -0.022762606, + 0.056777295, + 0.007817812, + 0.03355745, + 0.029163968, + 0.031967048, + 0.029959168, + -0.051568735, + 0.057294175, + -0.0156157445, + 0.03759309, + -0.046002332, + -0.020396886, + 0.053278416, + 0.016371185, + 0.03170861, + -0.015685324, + 0.0010555041, + 0.024094567, + 0.0051886817, + 0.012872304, + 0.004055521, + -0.03315985, + -0.013568103, + -0.023359006, + -0.072243944, + 0.026480168, + 0.025068687, + 0.009010613, + -0.018090805, + -0.025207847, + 0.009408212, + 0.0025123358, + 0.024591567, + -0.003725016, + -0.0053924513, + -0.025227727, + -0.055385694, + 0.012136743, + -0.011709323, + -0.041310653, + -0.021828245, + 0.04373601, + 0.030217608, + 0.023199966, + -0.012912064, + 0.020277606, + 0.021609565, + -0.031887528, + 0.014164504, + -0.062264178, + 0.03315985, + 0.0034218458, + -0.07550426, + 0.007653802, + -0.04544569, + -0.030973049, + -0.0029298158, + 0.041708253, + 0.053198896, + -0.03379601, + -0.010834603, + 0.025168087, + -0.031569447, + -0.023836127, + -0.025088567, + -0.009935033, + 0.0017009829, + -0.03395505, + 0.03174837, + -0.030814009, + -0.0155958645, + -0.0030192758, + 0.009477792, + -0.024830127, + -0.046757773, + 0.0055216714, + -0.015069044, + 0.024015047, + 0.015735025, + -0.020655327, + -0.020357126, + 0.015287724, + 0.003705136, + -0.03389541, + -0.026142208, + -0.041390173, + -0.03705633, + 0.06818842, + 0.03186765, + 0.007181652, + -0.012802724, + 0.030694729, + 0.025366887, + 0.064729296, + 0.029680848, + -0.011639743, + -0.0016351305, + 0.0029944258, + 0.021788485, + -0.017921826, + -0.03486953, + 0.040992573, + -0.021629445, + 0.03576413, + -0.07232346, + 0.004868116, + 0.055783294, + 0.031112209, + -0.046121612, + -0.049262654, + -0.04500833, + -0.023021046, + 0.03538641, + -0.020536046, + 0.006500762, + 0.031808008, + 0.03359721, + 0.052920576, + -0.017812485, + -0.014949764, + 0.028845888, + 0.019780606, + 0.019999286, + -0.020874007, + 0.0865973, + -0.057691775, + 0.019442646, + 0.03190741, + -0.079122424, + 0.046519212, + 0.018170325, + 0.012196383, + 0.013448824, + 0.009865453, + -0.0850069, + 0.0057204715, + -0.03270261, + 0.051727775, + -0.03242429, + -0.041151613, + 0.012902124, + 0.0003308157, + -0.011937943, + 0.0045102765, + 0.018617624, + -0.016401004, + -0.018369125, + 0.009716352, + 0.0052185017, + -0.024850007, + 0.019880006, + 0.03294117, + -0.004353721, + -0.04373601, + 0.019134505, + 0.0693017, + -0.016222084, + -0.03570449, + -0.050018094, + 0.003702651, + -0.028448287, + 0.047791533, + 0.00023576444, + 0.0012723204, + 0.0047712014, + 0.028030807, + -0.026162088, + 0.06846674, + -0.0069281817, + -0.025963288, + -0.004067946, + 0.011848483, + 0.0010604741, + -0.013090984, + -0.024174087, + -0.029541688, + -0.014224144, + 0.04238417, + 0.007236322, + 0.0034392409, + -0.03447193, + -0.013001524, + -0.03357733, + 0.007017642, + -0.008697502, + 0.011450883, + 0.030058568, + -0.019154385, + -0.014104864, + -0.022822246, + -0.011013523, + 0.024631327, + -0.0059391516, + 0.03238453, + 0.03644005, + -0.028925408, + 0.020774607, + -0.0029447258, + 0.0016053105, + 0.015426884, + 0.041946813, + 0.025426527, + 0.019094745, + -0.000408472, + 0.056061614, + -0.024492167, + -0.012385244, + -0.046996333, + -0.054868814, + 0.030694729, + 0.00025517851, + -0.059918337, + -0.045843292, + 0.0029571508, + -0.0068486617, + -0.03745393, + 0.03638041, + -0.031092329, + 0.0055167014, + 3.5877198e-05, + -0.042145614, + -0.0138861835, + -0.022086686, + -0.03785153, + 0.07232346, + -0.013031344, + -0.018657384, + -0.006461002, + -0.013826543, + 0.029422408, + -0.023716846, + 0.007141892, + -0.0025309732, + 0.0026788306, + 0.011659623, + -0.03838829, + -0.00011531956, + -0.007922182, + 0.022881886, + -0.06938122, + 0.002265078, + -0.0021681632, + -0.023736726, + 0.0750669, + 0.03610209, + -0.014820544, + -0.018041106, + 0.061429217, + 0.003287656, + -0.029800128, + 0.020436646, + 0.022941526, + -0.0022812306, + 0.020237846, + -0.019184206, + -0.0716873, + -0.022066806, + -0.039879292, + 0.014701264, + -0.0058447216, + -0.032245368, + 0.0060137017, + 0.010049343, + -0.021470405, + -0.0050147315, + 0.007718412, + 0.057413455, + -0.023657206, + 0.011798783, + 0.025943408, + -0.009199472, + -0.0021818306, + 0.040952813, + -0.032682728, + 0.018190205, + -0.0026639206, + 0.022444526, + 0.016629625, + -0.015466644, + -0.014800664, + 0.024512047, + 0.0016475555, + 0.014512404, + -0.058327936, + -0.012653624, + -0.010049343, + 0.064331695, + -0.025983168, + -0.010337603, + -0.017971525, + -0.013677443, + -0.010993643, + -0.056817055, + -0.027593447, + -0.009542403, + 0.010009583, + 0.014422944, + 0.014850364, + 0.007609072, + 0.054550733, + -0.011073163, + 0.039839532, + -0.024452407, + -0.024929527, + 0.017822426, + -0.007151832, + 0.014760904, + 0.007256202, + -0.045724012, + 0.009646772, + -0.027692847, + 0.017395005, + -0.007678652, + 0.0056459215, + 0.013220204, + 0.009607012, + -0.064013615, + 0.017116684, + -0.001591643, + 0.008886362, + -0.04234441, + -0.041310653, + -0.0020849155, + -0.04294081, + 0.013478644, + -0.028388647, + -0.010526463, + 0.022265606, + -0.004798536, + -0.014870244, + -0.027573567, + 0.057015855, + 0.04492881, + -0.011560223, + 0.0049749715, + -0.008364513, + -0.011540343, + 0.010228263, + 0.015029284, + 0.052960336, + -0.021331245, + -0.0029397558, + 0.058407456, + -0.04341793, + -0.011083103, + -0.022524046, + 0.03178813, + -0.014661504, + -0.03381589, + -0.055226654, + -0.0069679418, + 0.0030714609, + -0.03801057, + -0.023796367, + 0.008453973, + -0.019015225, + 0.024273487, + 0.007400332, + 0.04262273, + -0.026818128, + -0.0122659635, + 0.004773686, + 0.047155373, + 0.03572437, + 0.03767261, + 0.03482977, + 0.012941884, + 0.018597744, + 0.0012580316, + -0.012216263, + -0.07781034, + -0.03226525, + 0.015019344, + -0.0059987917, + 0.023120446, + 0.057135135, + -0.019989345, + 0.060196657, + -0.020416766, + 0.012434944, + -0.024392767, + -0.021072807, + -0.057612255, + -0.016659444, + -0.04242393, + -0.03741417, + 0.023040926, + 0.051250655, + 0.012434944, + 0.062184658, + 0.011480703, + 0.0044829412, + 0.0021992256, + -0.017723026, + -0.020327305, + 0.021132445, + -0.03870637, + 0.07005714, + 0.019383006, + -0.016540164, + 0.03753345, + -0.03630089, + 0.018786605, + -0.010755083, + -0.022186086, + -0.0048109614, + 0.052284416, + 0.023418646, + -0.011997583, + 0.017563986, + 0.024671087, + -0.013130744, + -0.04520713, + -0.030376649, + 0.04298057, + 0.04266249, + 0.018667325, + -0.03809009, + -0.029621208, + 0.053397696, + 0.041787773, + -0.018776665, + 0.015347364, + -0.004224501, + -0.03628101, + -0.030654969, + -0.024333127, + -0.004423301, + -0.050813295, + 0.021689085, + -0.002314778, + 0.016748905, + 0.008260142, + 0.020476406, + 0.052801296, + -0.004714046, + 0.015814545, + -0.0106358025, + -0.049103614, + -0.027513927, + -0.030913409, + -0.016301604, + -0.008329722, + 0.040833533, + 0.03230501, + -0.050614495, + 0.014492524, + 0.03178813, + -0.011361423, + -0.024472287, + 0.017375125, + -0.018895945, + -0.032245368, + 0.017544106, + -0.017315485, + 0.010437003, + -0.024333127, + 0.020317366, + 0.010685503, + 0.012484644, + 0.011629803, + -0.015874185, + 0.009602043, + 0.001994213, + -0.023895767, + 0.030575449, + 0.036121972, + 0.039680492, + -0.03906421, + -0.028726608, + 0.026818128, + 0.027275367, + -0.018548045, + -0.03502857, + -0.014949764, + 0.03822925, + 0.010347543, + 0.0016599805, + -0.009626892, + -0.021708965, + 0.011669563, + 0.0053328113, + 0.060554497, + 0.003690226, + -0.0015096379, + -0.030257368, + -0.026261488, + -0.0060137017, + -0.03385565, + -0.010054313, + 0.024909647, + -0.024154207, + 0.011232203, + 0.0012617591, + 0.008881393, + 0.03846781, + 0.014939824, + 0.009318752, + 0.048030093, + -0.016351305, + -0.014234084, + 0.019621566, + -0.055504974, + 0.023677086, + -0.021013167, + 0.001827718, + 0.03508821, + 0.003188256, + 0.025585568, + 0.04262273, + 0.0028428407, + -0.026639208, + 0.023319246, + -0.014353364, + -0.014661504, + -0.003752351, + 0.0155958645, + 0.010526463, + 0.012096983, + 0.010745143, + 0.013498524, + 0.049739774, + 0.03357733, + -0.016162444, + 0.023279486, + 0.021152325, + -0.04298057, + 0.013975644, + 0.018329365, + 0.025187967, + -0.017563986, + 0.03592317, + 0.006396392, + -0.007166742, + 0.04512761, + 0.0057055615, + -0.010675563, + 0.006267172, + -0.04302033, + -0.0021656782, + -0.03371649, + 0.026838008, + -0.028567567, + 0.0015270329, + 0.003747381, + -0.011102983, + 0.004674286, + 0.025963288, + -0.008419182, + 0.023100566, + 0.010397243, + -0.025923528, + 0.012723204, + 0.0028030807, + 0.022782486, + 0.011699383, + -0.029979048, + 0.03618161, + -0.0041524363, + -0.007822782, + 0.019363126, + -0.026678968, + -0.048825294, + 0.041787773, + 0.03250381, + -0.0009753628, + 0.0054620313, + 0.017086865, + -0.011679503, + -0.022245726, + -0.010153713, + -0.029641088, + 0.013289784, + 0.023696966, + 0.048109613, + -0.003876601, + -0.0017991405, + 0.020714967, + 0.03528701, + -0.027494047, + -0.017822426, + -0.000420897, + -0.018418824, + 0.024531927, + 0.040634733, + 0.028150087, + -0.010755083, + -0.008439062, + 0.04461073, + 0.007499732, + -0.025863888, + 0.030555569, + -0.028746488, + 0.0027633207, + -0.0028080507, + -0.008106072, + -0.0053924513, + 0.0058099316, + 0.031450167, + 0.023498166, + 0.011490643, + -0.003946181, + 0.007385422, + 0.026639208, + -0.04234441, + 0.0034119058, + -0.047274653, + 0.0052980212, + 0.0026142208, + 0.025207847, + -0.010755083, + 0.012762964, + 0.031132089, + 0.012474704, + 0.022265606, + 0.04282153, + 0.007355602, + 0.0097561125, + -0.016609745, + -0.058009855, + -0.020893887, + -0.029959168, + -0.000963559, + 0.017255845, + -0.020635447, + -0.009129892, + 0.023597566, + -0.023677086, + -0.011659623, + 0.026420528, + 0.024929527, + 0.0015096379, + 0.007286022, + 0.016013345, + 0.029342888, + -0.012494584, + -0.015387124, + -0.046638492, + 0.0005808689, + -0.009020553, + -0.010506583, + -0.0022961407, + -0.0017320454, + -0.019720966, + 0.015188324, + -0.020734847, + 0.001775533, + -0.0022439556, + 0.029919408, + -0.003777201, + 0.06484858, + -0.003720046, + -0.008150802, + -0.015516344, + 0.013786783, + -0.06635946, + 0.007117042, + -0.0049724863, + 0.00073990895, + 0.011102983, + -0.020098686, + -0.0044879112, + -0.017116684, + 0.028547687, + 0.0058149016, + -0.012603924, + -0.03693705, + -0.020317366, + -0.0024029957, + -0.020933647, + -0.024392767, + -0.003772231, + 0.030654969, + 0.010456883, + -0.030873649, + -0.03606233, + -0.008230322, + -0.000918829, + -0.023696966, + 0.001904753, + -0.04512761, + -0.013438884, + -0.025585568, + -0.029183848, + -0.03375625, + 0.010327663, + 0.03242429, + -0.009050372, + 0.008160742, + -0.03427313, + -0.049183134, + 0.029422408, + -0.021987285, + 0.0025819158, + -0.011262023, + 0.014959704, + -0.0020724905, + -0.030953169, + 0.03453157, + -0.0027384707, + -0.011331603, + 0.060156897, + 0.008339662, + 0.00091448025, + -0.039322652, + -0.0013742053, + 0.03226525, + -0.03321949, + -0.002004153, + 0.06556426, + -0.008946002, + -0.023875887, + 0.0012238629, + 0.0013829028, + 0.013717203, + -0.022961406, + 0.026241608, + -0.024452407, + -0.028189847, + -0.020039046, + -0.0018836305, + -0.021430645, + 0.0052532917, + -0.018488405, + 0.011301783, + -0.0059292116, + 0.018319424, + 0.008066312, + -0.0002029935, + -0.024730727, + 0.010745143, + 0.023836127, + 0.022365006, + -0.018518224, + 0.022702966, + -0.007350632, + -0.0015531254, + -0.014025344, + 0.015407004, + -0.017275725, + -0.0014524829, + 0.006441122, + 0.003921331, + 0.0054570613, + -0.010715323, + -0.032483928, + -0.0026564656, + 0.03584365, + -0.0061429217, + 0.012951824, + 0.030992929, + -0.022504166, + 0.00093436026, + 0.017335365, + 0.04508785, + 0.03492917, + 0.007131952, + -0.0028826008, + -0.014442824, + 0.018269725, + 0.021271605, + -0.016053105, + -0.020108625, + -0.029760368, + -0.0052334117, + 0.040833533, + 0.002319748, + 0.0068337517, + -0.014780784, + 0.006769142, + 0.0054471213, + -0.00095424027, + -0.03910397, + 0.023975287, + -0.015198264, + 0.016381124, + 0.022702966, + -0.025923528, + 0.002024033, + -0.009621923, + -0.004868116, + -0.019899886, + 0.019522166, + 0.028329007, + -0.052284416, + -0.0010331391, + -0.027474167, + 0.014830484, + 0.008906242, + 0.03604245, + -0.023557806, + 0.023359006, + 0.0021731332, + -0.008488762, + 0.03659909, + -0.019750785, + -0.016361244, + 0.011729203, + -0.026559688, + -0.015814545, + 0.010516523, + -0.018180264, + -0.065047376, + 0.011550283, + 0.007619012, + -0.07443074, + -0.006709502, + 0.03789129, + -0.007305902, + -0.027692847, + -0.008583193, + 0.014949764, + -0.032006808, + 0.020078806, + 0.061667778, + 0.014015404, + 0.021788485, + 0.0029571508, + -0.0005147058, + 0.0044307564, + -0.015645564, + -0.07121018, + 0.007355602, + -0.014413004, + 0.03286165, + 0.015804604, + -0.0015481554, + 0.030674849, + -0.03640029, + 0.0097561125, + -0.017673325, + -0.013796723, + 0.03387553, + 0.019790545, + 0.026022928, + 0.009010613, + -0.025744608, + -0.0002453938, + -0.022842126, + 0.058447216, + -0.03719549, + 0.027633207, + -0.006774112, + -0.012146683, + 0.016768785, + -0.0045127613, + 0.009462883, + 0.039362412, + -0.03238453, + -0.004000851, + 0.020416766, + 0.018130565, + 0.0082551725, + 0.003792111, + -0.008220382, + -0.0090354625, + 0.016033225, + -0.00014125675, + -0.0026092508, + 0.015715145, + -0.0044009364, + -0.018776665, + -0.011202383, + 0.019522166, + -0.052841056, + -0.00079892774, + 0.041668493, + 0.03737441, + -0.013230144, + 0.021132445, + 0.004219531, + -0.04278177, + -0.018886006, + -0.021251725, + 0.024154207, + -0.009656712, + 0.04274201, + 0.014611804, + 0.001763108, + 0.0098058125, + -0.0060236417, + -0.0017519254, + 0.010864423, + 0.020675207, + -0.021033047, + 0.003993396, + 0.014452764, + -0.03993893, + 0.025466288, + 0.022524046, + -0.008598102, + 0.000807004, + -0.0023185057, + 0.017295605, + -0.012574104, + -0.023796367, + 0.012822604, + 0.025943408, + -0.004463061, + 0.0006352283, + 0.008439062, + -0.008886362, + -0.03353757, + 0.022563806, + -0.000978469, + -0.0009703928, + 0.0013207778, + -0.00025067443, + -0.047513213, + 0.06437146, + 0.010407183, + 0.0008132165, + -0.0051290416, + 0.029959168, + -0.0090652825, + -0.001760623, + 0.019035105, + 0.04329865, + 0.021887885, + 0.025227727, + 0.0029273308, + 0.030654969, + -0.024810247, + -0.022325246, + 0.024551807, + -0.028229607, + 0.031291127, + 0.029303128, + 0.03347793, + 0.020595687, + 0.022643326, + 0.030615209, + 0.03379601, + 0.006272142, + 0.016152505, + 0.0015730055, + -0.03451169, + 0.019293545, + 0.009159712, + -0.0017071954, + -0.011431003, + 0.03816961, + -0.027454287, + 0.024850007, + -0.016798604, + 0.019333305, + -0.0047314414, + 0.03447193, + -0.006421242, + 0.023557806, + 0.029004928, + -0.022126446, + 0.029124208, + 0.016639564, + 0.023060806, + 0.009527492, + -0.047234893, + 0.008667682, + 0.029521808, + 0.014104864, + -0.008444033, + 0.019273665, + 0.022484286, + -0.012504524, + 0.030118208, + 0.0024005107, + 0.0024676058, + -0.0082054725, + 0.026142208, + 0.010198443, + -0.001658738, + 0.021172205, + 0.023995167, + -0.009701443, + 0.0025471258, + 0.03282189, + 0.0058049615, + 0.0027956257, + 0.028428407, + -0.0034243308, + -0.0047960514, + 0.024193967, + -0.0139160035, + 0.012802724, + -0.008369482, + -0.011311723, + -0.031768247, + 0.032762248, + 0.0012226204, + 0.019780606, + 0.010496643, + 0.006510702, + -0.009244203, + -0.0060385517, + -0.007748232, + -0.015844364, + -0.020834247, + 0.0068586017, + 0.012057223, + -0.028309127, + 0.009000673, + -0.0058745416, + 0.015665444, + 0.007161772, + 0.024969287, + -0.040754013, + -0.024034927, + 0.012464764, + -0.041072093, + 0.0082154125, + -0.014711204, + 0.040754013, + -0.006441122, + 0.015377184, + -0.03797081, + -0.024571687, + 0.03170861, + -0.017285665, + -0.026122328, + -0.0013307178, + -0.010794843, + 0.006674712, + -0.004239411, + 0.052204896, + -0.023975287, + -0.0023011107, + -0.03347793, + 0.03162909, + 0.03651957, + -0.024512047, + 0.016560044, + 0.007763142, + 0.003367176, + 0.018647445, + -0.03323937, + 0.0077929622, + 0.015695265, + 0.004028186, + 0.011083103, + 0.016092865, + -0.014263904, + 0.030953169, + 0.002411693, + -0.013627743, + -0.017096804, + -0.0105960425, + -0.031151969, + 0.008752173, + 0.007499732, + -0.03703645, + -0.04524689, + -0.017454645, + -0.009318752, + 0.016331425, + 0.017941706, + 0.052761536, + 0.011331603, + 0.058168896, + 0.049103614, + 0.022424646, + 0.03250381, + 0.009537432, + -0.010934003, + -0.021569805, + 0.007236322, + 0.018895945, + -0.0015779755, + -0.020993287, + -0.008970853, + -0.029462168, + 0.008150802, + 0.012842484, + 0.013200324, + 0.00045506575, + -0.011778903, + 0.011540343, + 0.003225531, + 0.027752487, + -0.009522523, + 0.013727143, + 0.014681384, + 0.010516523, + -0.007867512, + 0.017216085, + -0.0047910814, + 0.003976001, + 0.03735453, + -0.025068687, + 0.04361673, + 0.04321913, + 0.029541688, + -0.0015208204, + 0.0051290416, + -0.0010256841, + 0.026500048, + -0.00057931576, + 0.023160206, + 0.0090354625, + -0.017454645, + -0.04345769, + -0.001827718, + -0.023498166, + -0.008125952, + 0.006217472, + 0.025486168, + -0.019432705, + 0.010407183, + 0.032006808, + -0.03250381, + 0.019373065, + 0.007107102, + -0.006585252, + 0.049183134, + 0.023597566, + 0.026460288, + 0.021271605, + 0.019263726, + 0.012087043, + 0.010864423, + 0.029601328, + 0.006490822, + 0.006341722, + -0.00012300753, + -0.0009902727, + 0.020476406, + -0.03453157, + 0.026539808, + -0.023796367, + -0.0057950215, + -0.003570946, + -0.013776843, + 0.00049513637, + 0.001666193, + 0.047195133, + 0.020377006, + -0.023875887, + 0.003623131, + 0.025724728, + -0.029482048, + -0.007156802, + -0.012832544, + -0.016609745, + -0.011212323, + 0.049501214, + -0.010034433, + -0.010456883, + -0.013329544, + 0.017335365, + -0.023438526, + 0.008657742, + -0.007723382, + -0.006490822, + 0.0023359007, + 0.0059640016, + -0.0138762435, + -0.0053775413, + 0.03479001, + -0.029243488, + -0.011609923, + -0.006242322, + 0.00025347006, + -0.04294081, + -0.025187967, + 0.029482048, + 0.03759309, + 0.013587983, + 0.018687205, + -0.03371649, + 0.017275725, + 5.8242204e-05, + 0.007102132, + 0.007276082, + -0.009790903, + -0.026122328, + -0.03310021, + 0.014174444, + 0.019482406, + 0.030018808, + 0.013458764, + 0.03622137, + -0.029641088, + 0.017166385, + -0.011371363, + 0.03914373, + 0.026360888, + 0.018995345, + -0.006366572, + -0.027036808, + -0.015913945, + 0.023776487, + 0.006719442, + -0.018150445, + 0.007271112, + -0.012882244, + -0.017295605, + -0.026102448, + 0.015735025, + -0.003754836, + 0.0048258714, + -0.022404766, + -0.040913053, + 0.016251905, + -0.030217608, + -0.028309127, + -0.04397457, + -0.03504845, + -0.012395184, + -0.039402172, + -0.019542046, + 0.03584365, + -0.020555926, + 0.0053029913, + -0.030217608, + 0.013170504, + -0.017424826, + 0.04357697, + 0.008439062, + 0.012385244, + 0.021410765, + 0.040594973, + 0.009989703, + 0.021748725, + 0.041429933, + -0.019204086, + -0.013737083, + -0.0055564614, + 0.025068687, + 0.04286129, + 0.00016866942, + 0.025048807, + -0.014234084, + 0.0015904005, + -0.024472287, + -0.003556036, + -0.0011983915, + -0.029541688, + -0.030237488, + 0.012444884, + -0.039760012, + 0.000839309, + 0.022365006, + 0.028786248, + -0.03315985, + 0.025744608, + -0.007067342, + -0.012643684, + -0.026102448, + 0.001646313, + 0.019243846, + -0.023875887, + -0.010735203, + -0.017474525, + 0.0077929622, + 0.04425289, + -0.026181968, + -0.017305546, + -0.018687205, + 0.032086328, + 0.009070252, + 0.017872125, + 0.003565976, + 0.0025844008, + 0.011599983, + 0.027692847, + 0.023140326, + -0.004130071, + 0.03496893, + 0.018051045, + -0.03437253, + -0.011122863, + 0.0053825113, + -0.012534344, + 0.007837692, + 0.030515809, + 0.006207532, + -0.03292129, + -0.011252083, + 0.009830663, + -0.010228263, + 0.013468704, + -0.011878303, + -0.008125952, + 0.04317937, + -0.04536617, + 0.003700166, + -0.016440764, + 0.020635447, + 0.0038964811, + -0.028070567, + -0.015049164, + -0.0051340116, + -0.0041027362, + -0.004299051, + -0.054630253, + -0.0048879962, + 0.0139259435, + 0.017116684, + 0.010387303, + 0.012872304, + -0.019780606, + -0.0017892005, + 0.009020553, + 0.010218323, + 0.032642968, + 0.004818416, + -0.026380768, + 0.0058248416, + 0.040952813, + -0.021828245, + -0.014452764, + 0.0011344028, + -0.03194717, + 0.007857572, + -0.012067163, + -0.0047264714, + 0.0022153782, + -0.0030764309, + -0.021052927, + -0.015983524, + 0.00041685888, + -0.022464406, + 0.0089957025, + -0.03974013, + 0.0022663206, + 0.052284416, + -0.020436646, + 0.026758488, + -0.0027484107, + 0.0056757415, + -0.0058795116, + 0.011093043, + 0.023199966, + -0.00015049786, + 0.012444884, + 0.03296105, + -0.010536403, + -0.011321663, + -0.020029105, + 0.007991762, + -0.041867293, + 0.025863888, + -0.003715076, + 0.016490465, + 0.014333484, + 0.0034566359, + 0.029998928, + -0.003106251, + -0.006257232, + -0.027613327, + -0.023239726, + -0.013230144, + -0.054113377, + 0.03447193, + -0.008001702, + 0.012037343, + 0.009597072, + 0.017554045, + -0.0021905282, + -0.001618978, + 0.0082651125, + -0.0011232203, + -0.007927152, + -0.018478464, + -0.009974793, + -0.019303486, + -0.039600972, + -0.0155859245, + 0.030476049, + 0.017226025, + -0.024313247, + 0.010039403, + 0.004234441, + -0.018707085, + 0.011023463, + -0.018488405, + 0.016798604, + 0.04373601, + -0.024710847, + 0.0069281817, + 0.0028279307, + 0.004015761, + -0.009085163, + 0.0030590359, + -0.0059242416, + -0.010705383, + -0.012653624, + 0.000961074, + 0.011142743, + -0.003352266, + 0.047871053, + -0.04544569, + -0.0015233054, + 0.023875887, + 0.00043021573, + 0.007474882, + -0.017206145, + -0.004443181, + -0.014035284, + 0.018001346, + 0.0011685715, + -0.020635447, + 0.0014760904, + 0.027832007, + 0.015397064, + -0.031489927, + 0.015327484, + 0.014015404, + 0.013518404, + 0.028905528, + -0.024690967, + 0.024810247, + -0.026181968, + -0.015317544, + 0.010993643, + 0.011450883, + 0.030297128, + 0.009920123, + -0.020068865, + 0.0053029913, + 0.015108804, + 0.0007604102, + -0.019144446, + -0.017365186, + 0.003215591, + 0.0025148208, + -0.023975287, + 0.004709076, + -0.021390885, + -0.012027403, + 0.024869887, + -0.028905528, + -0.03638041, + 0.0043015364, + -0.029859768, + 0.006232382, + -0.0069629718, + -0.0024464831, + 0.013120804, + 0.031231489, + 0.0082154125, + 0.0013232628, + 0.0028552657, + -0.009219352, + 0.019144446, + -0.006774112, + 0.0034094208, + -0.03500869, + 0.026221728, + -0.026718728, + 0.03735453, + 0.0155958645, + -0.0059242416, + -0.023677086, + -0.014691324, + 0.013359364, + -0.004299051, + 0.016500404, + 0.009209412, + 0.004085341, + -0.010774963, + -0.004738896, + 0.016490465, + -0.027315127, + 0.021033047, + -0.03445205, + 0.031092329, + 0.006749262, + -0.008806842, + -0.008056372, + -0.04441193, + 0.014184384, + -0.0155859245, + 0.016560044, + 0.007375482, + 0.011440943, + -0.026162088, + -0.018120624, + -0.012772904 + ], + "Category": "Boutique", + "Tags": [ + "view", + "air conditioning", + "concierge" + ] + }, + { + "@search.action": "mergeOrUpload", + "HotelId": "2", + "HotelName": "Old Century Hotel", + "Description": "The hotel is situated in a nineteenth century plaza, which has been expanded and renovated to the highest architectural standards to create a modern, functional and first-class hotel in which art and unique historical elements coexist with the most modern comforts. The hotel also regularly hosts events like wine tastings, beer dinners, and live music.", + "DescriptionVector": [ + -0.04683398, + -0.01285595, + 0.03386663, + -0.015239983, + -0.0033393162, + -0.014727527, + -0.012042706, + -0.011630513, + 0.0024954358, + -0.037431534, + 0.006550519, + 0.021155503, + -0.06024695, + -0.036050133, + 0.0026764662, + 0.036094695, + -0.06069256, + 0.014025685, + 0.052270465, + 0.01747919, + -0.020620765, + -0.017501472, + -0.04121925, + -0.07085255, + 0.01518428, + 0.013591212, + -0.06412379, + 0.050488014, + 0.020865854, + 0.05596906, + -0.001694724, + -0.020999538, + 0.0724122, + 0.038099956, + -0.023907166, + -0.055077832, + 0.015050597, + 0.011842179, + 0.0164877, + 0.014359896, + -0.032730315, + 0.012087267, + 0.01220981, + -0.011463407, + -0.00083482906, + -0.027271548, + -0.024285937, + 0.049953274, + -0.0077592456, + 0.0072412197, + -0.04284574, + 0.006394554, + -0.0024355564, + -0.0005716386, + -0.039369956, + 0.035426274, + -0.008778586, + -0.04821538, + 0.057439584, + 0.011274022, + 0.055612568, + 0.0020456447, + 0.06715396, + 0.016209193, + -0.06875817, + 0.031839088, + -0.026491724, + 0.029811544, + 0.016342876, + -0.009335604, + 0.038345043, + 0.036339782, + -0.0041637016, + -0.043313634, + -0.03622838, + -0.026825935, + 0.0059099495, + -0.00022872507, + -0.004712363, + 0.015540771, + -0.066619225, + -0.00857806, + -0.034980662, + 0.07210027, + 0.014215072, + -0.0058709583, + -0.0051830425, + 0.011909021, + -0.030903298, + 0.04516293, + 0.044739597, + 0.046611175, + 0.034133997, + 0.0056509366, + 0.015451649, + -0.017356647, + 0.0119647235, + -0.009001393, + -0.013245862, + 0.06327712, + 0.047235034, + -0.058108002, + 0.021589976, + -0.012310074, + -0.011418846, + -0.00444221, + 0.015195421, + -0.029922947, + 0.014816649, + -0.02078787, + -0.078160614, + -0.030212596, + -0.067822374, + -0.009346744, + -0.028274179, + -0.011246171, + 0.028318739, + -0.016298315, + -0.018660067, + -0.0020957761, + -0.005776265, + 4.8216774e-05, + -0.06185116, + -0.009981743, + -0.0084499465, + -0.0759771, + -0.014772088, + -0.049596786, + -0.008600341, + -0.021122081, + -0.019595854, + -0.0056481515, + 0.035493117, + -0.013535511, + -0.027561197, + 0.03125979, + 0.0224255, + 0.021545414, + -0.034557328, + -0.014315334, + -0.0031749962, + 0.023639798, + -0.023483833, + -0.02272629, + 0.0036484606, + 0.014025685, + 0.031059263, + 0.00037354947, + -0.032752592, + 0.0514238, + 0.00067712367, + 0.040261183, + 0.01584156, + 0.0109453825, + -0.034846976, + 0.012555161, + 0.01847068, + -0.008967972, + -0.037698902, + 0.04915117, + -0.031616278, + 0.0072690705, + -0.025912426, + 0.023684358, + 0.01418165, + 0.04901749, + -0.03792171, + 0.0058709583, + -0.03359926, + 0.022146992, + 0.006812317, + 0.016721647, + -0.030524526, + 0.064480275, + 0.04313539, + 0.04870556, + 0.006333282, + 0.005478261, + 0.019740678, + 0.010817268, + 0.002482903, + 0.01021569, + 0.07824974, + -0.008444376, + -0.027382951, + 0.02108866, + -0.09473743, + 0.010132138, + -0.004305741, + 0.014738667, + -0.012900512, + -0.01418165, + -0.020119451, + 0.031393472, + -0.023171904, + -0.009864769, + -0.021601116, + 0.028942598, + -0.002686214, + -0.010778277, + -0.06465852, + -0.06670834, + 0.009920471, + -0.0036985923, + -0.007642272, + -0.042778898, + 0.016231472, + -0.0059712213, + -0.014560422, + 0.0007401362, + -0.0013333592, + -0.030190317, + 0.03400031, + 0.026536286, + 0.0050215074, + -0.03658487, + -0.0626087, + 0.031081542, + -0.0051635467, + 0.050220642, + -0.020643046, + -0.017490331, + -0.020921554, + 0.02802909, + -0.017211823, + 0.0021319822, + -0.006823457, + -0.025154883, + -0.024196815, + -0.008940121, + -0.013346125, + -0.03660715, + -0.02108866, + 0.000490523, + -0.012566301, + 0.004812626, + -0.060870808, + 0.0074974475, + 0.03368838, + 0.049284857, + -0.033777505, + -0.011842179, + 0.02898716, + -0.0062664403, + 0.0500424, + 0.0040912894, + -0.019562434, + -0.04580907, + 0.030546807, + 0.03680768, + -0.053161692, + 0.015685596, + -0.0113074435, + -0.010043015, + 0.02996751, + 0.005514467, + -0.03883522, + -0.009636393, + -0.012466039, + -0.012544021, + 0.08306236, + 0.0016195267, + -0.030101193, + -0.004511837, + -0.005776265, + -0.034044873, + -0.00019164862, + 0.040238902, + -0.0070406934, + -0.02704874, + -0.027160143, + -0.017935945, + -0.039748725, + 0.0021528704, + 0.0055590286, + -0.029276809, + 0.004347517, + -0.019818662, + 0.017724277, + -0.014627264, + -0.019016556, + -0.061762035, + 0.037097327, + 0.014393317, + -0.040350303, + 0.043380477, + 0.04901749, + 0.0063555627, + -0.009981743, + -0.005447625, + 0.025600497, + -0.024308218, + 0.006723194, + -0.002704317, + -0.0064781066, + 0.017624015, + 0.01584156, + -0.02736067, + -0.03154944, + -0.009296612, + -0.03197277, + 0.024330499, + 0.040706795, + 0.010410646, + -0.03417856, + 0.036651712, + 0.0021166643, + 6.2229235e-05, + 0.02204673, + 0.021188922, + 0.032195576, + 0.012443758, + 0.009313323, + -0.055879936, + -0.028385581, + 0.002272629, + 0.0013486772, + 0.025823304, + -0.013067616, + -0.03600557, + 0.007480737, + 0.005865388, + 0.005015937, + 0.01747919, + 0.03357698, + -0.0729915, + -0.0030496675, + 0.0073024915, + -0.015696736, + -0.039459076, + 0.0034451496, + -0.01915024, + 0.013914282, + -0.027249267, + -0.038679253, + 0.040149778, + -0.0066674924, + 0.07464027, + 0.02666997, + -0.025979267, + -0.01053876, + -0.055612568, + -0.034111716, + -0.019584714, + 0.05641467, + -0.047279596, + -0.007959772, + -0.039035745, + 0.042110477, + 0.03567136, + -0.06697571, + -0.012466039, + 0.015306825, + 0.04382609, + 0.029120844, + -0.0013598176, + 0.051824853, + 0.03785487, + -0.08234938, + 0.0045563984, + -0.035203468, + -0.028452424, + 0.0016195267, + 0.0119424425, + -0.01088411, + -0.0051273406, + -0.009981743, + -0.006450256, + -0.014738667, + -0.04514065, + -0.03894662, + -0.027850846, + 0.0048683276, + -0.00792078, + -0.05904379, + 0.037721183, + 0.030101193, + 0.0001987854, + 0.0069961324, + -0.042444687, + 0.032039613, + -0.0029689001, + 0.012588582, + -0.037075046, + 0.035805047, + 0.0019161381, + 0.023127342, + -0.00824385, + 0.0041748416, + 0.027182424, + 0.019707259, + -0.04710135, + -0.01714498, + -0.03890206, + 0.02370664, + -0.021266906, + 0.034089435, + -0.006227449, + -0.026892776, + -0.011831039, + 0.017501472, + -0.039102588, + 0.0019314562, + -0.048660997, + -0.028073652, + -0.04449451, + 0.014883491, + -0.008656043, + 0.0073916144, + 0.028786633, + -0.027895406, + -0.011235031, + 0.01683305, + -0.009848059, + -0.013736037, + -0.015596474, + 0.025801023, + -0.04342504, + 0.00024056167, + 0.027405232, + 0.04683398, + 0.028764352, + 0.022336379, + 0.013568932, + 0.0010987158, + -0.009318893, + -0.031616278, + -0.03569364, + -0.055256076, + -0.040060654, + -0.00070358196, + -0.020810151, + -0.015373667, + -0.012889371, + -0.04378153, + 0.0659508, + -0.050220642, + 0.00956955, + 0.010633453, + 0.0067733256, + -0.050621696, + -0.012800248, + 0.005043788, + -0.029945228, + 0.007514158, + 0.054498535, + 0.013312704, + 0.07504132, + -0.00010800906, + -0.036540307, + -0.0077592456, + 0.00039513386, + -0.024642428, + -0.021679098, + 0.0028004025, + 0.0026639334, + 0.017701996, + 0.012388056, + 0.00957512, + -0.017122699, + 0.0035844038, + -0.03584961, + -0.023751201, + 0.017222963, + 0.02278199, + -0.036094695, + -0.03847873, + 0.074194655, + 0.01155253, + -0.05659292, + -0.029410493, + -0.016632525, + 0.061762035, + 0.023149623, + 0.0061661773, + -0.013502089, + 0.0030524526, + 0.05997958, + 0.0049184593, + 0.012889371, + 0.019495592, + 0.009508278, + 0.0020512147, + -0.00428903, + -0.012633143, + -0.023951726, + -0.042021357, + -7.0279864e-05, + -0.028251898, + -0.015752438, + -0.0052638096, + -0.007998763, + 0.008004333, + -0.0078817895, + -0.001859044, + 0.037052765, + -0.029031722, + -0.02435278, + -0.023550674, + -0.0026639334, + 0.0081992885, + 0.012978494, + 0.020654187, + 0.016120069, + 0.02566734, + 0.06568343, + -0.0031443604, + -0.001451029, + 0.041085567, + -0.004043943, + -0.007798237, + -0.020598484, + 0.003392233, + 0.0113965655, + 0.029254528, + 0.014850071, + 0.019127961, + 0.014359896, + -0.021356028, + -0.013758318, + 0.016231472, + 0.018660067, + -0.01418165, + 0.011162619, + 0.0033198209, + 0.041018724, + -0.029856106, + -0.060514316, + -0.008422095, + -0.021578835, + -0.011246171, + -0.013669195, + 0.00069139723, + -0.023216464, + 0.019261645, + -0.013914282, + 0.018715767, + 0.014783229, + 0.033799786, + 0.004742999, + 0.038099956, + 0.018504102, + -0.037498377, + -0.018069629, + -0.015607614, + -0.019339627, + -0.023327868, + 0.0025650628, + -0.009307752, + 0.0030134614, + 0.05841993, + 0.014215072, + -0.038345043, + 0.0022489557, + -0.0092242, + -0.0062441593, + 0.023149623, + 0.045051526, + 0.0026179794, + 0.045385737, + -0.015574193, + 0.0048989635, + -0.004999227, + 0.036362063, + 0.02602383, + -0.0269819, + 0.007436176, + 0.05075538, + 0.01681077, + -8.929677e-05, + -0.019306205, + 0.020353397, + -0.0048544025, + 0.043514162, + 0.006021353, + 0.029455055, + 0.0010799165, + 0.0044867713, + -0.013624634, + 0.018225593, + 0.022291817, + -0.0060436334, + 0.016342876, + 0.020030327, + -0.019963486, + -0.015897263, + 0.06523782, + 0.049685907, + 0.01549621, + 0.02936593, + 0.010020734, + -0.0016989015, + -0.0031248648, + -0.028318739, + 0.0230605, + -0.005166332, + -0.0051440513, + 0.007319202, + -0.030791894, + 0.068045184, + -0.014738667, + -0.0230605, + 0.006879159, + 0.009803497, + -0.0082215695, + 0.04585363, + -0.0029772553, + -0.017189542, + -0.010705865, + -0.025645059, + -0.00084318436, + -0.017111558, + -0.008739595, + -0.04875012, + -0.04121925, + 0.00010339626, + -0.035649084, + -0.010583322, + 0.014983755, + -0.008979113, + -0.0077536753, + 0.010605602, + 0.008383105, + 0.02666997, + 0.0066117905, + 0.031036982, + 0.013301563, + -0.002193254, + -0.014560422, + 0.025221726, + 0.042868022, + 0.016242612, + 0.03092558, + -0.024441902, + -0.028920317, + 0.035181187, + 0.03892434, + -0.0054337, + 0.010004024, + -0.02671453, + 0.0079040695, + 0.019250505, + 0.030212596, + 4.560576e-05, + 0.009731085, + 0.025132602, + 0.02929909, + 0.020921554, + 0.018927434, + -0.01055547, + -0.029276809, + 0.028942598, + 0.03560452, + -0.006032493, + 0.0017685287, + -0.0056592915, + -0.032685753, + -0.011040075, + -0.007970911, + 0.025466813, + 0.00892341, + 0.054765902, + -0.012120687, + -0.01810305, + 0.0019091754, + 0.020119451, + -0.0013347517, + -0.00230048, + -0.05240415, + 0.03304224, + 0.0718329, + 0.03195049, + 0.04776977, + 0.02435278, + 0.03137119, + 0.013680335, + -0.017378928, + -0.026803654, + -0.00013011567, + -0.010393935, + -0.003963175, + 0.018203313, + -0.02961102, + 0.0041637016, + 0.014916913, + 0.0039325394, + -0.020954976, + 0.06880273, + 0.022291817, + 0.00724679, + -0.00088426436, + 0.0041024294, + 0.008906701, + 1.8549097e-05, + 0.035827328, + -0.03166084, + 0.00888442, + -0.02466471, + -0.02802909, + -0.04222188, + 0.018983137, + 0.0062720105, + -0.0045731086, + -0.014549281, + 0.012020425, + 0.011630513, + 0.021835063, + -0.014749807, + 0.030769615, + 0.013791738, + 0.025845584, + -0.02867523, + 0.00033890997, + -0.0050215074, + 0.049195733, + 0.03569364, + -0.024575585, + 0.013903142, + -0.0052220332, + -0.017189542, + 0.021055238, + 0.00956955, + -0.013969984, + -0.043581, + -0.021333747, + -0.014939194, + -0.0018270154, + -0.009719945, + -0.015262263, + 0.05828625, + -0.009853629, + 0.0049936567, + 0.0058375373, + -0.0027015319, + 0.053161692, + -0.01483893, + 0.03362154, + 0.011190469, + -0.008082315, + 0.005639796, + -0.014226212, + -0.024686988, + -0.0047959154, + -0.03322049, + 0.024597866, + -0.044717316, + 0.016086647, + -0.020542784, + -0.05690485, + 0.025600497, + -0.058152564, + 0.007051834, + 0.019930065, + 0.0049546654, + -0.0024230236, + -0.03988241, + 0.022536904, + 0.062163085, + 0.006160607, + 0.021211203, + -0.012933932, + 0.008327403, + -0.006121616, + 0.029232247, + 0.003924184, + -0.007447316, + 0.04516293, + 0.013658054, + -0.022692868, + -0.04349188, + 0.016053228, + -0.022169273, + -0.010483058, + 0.010360515, + -0.0006656352, + -0.013346125, + 0.027494354, + -0.038411885, + 0.0060436334, + -0.015975244, + 0.031415753, + -0.030747334, + -0.017746558, + 0.0052276035, + 0.026313478, + -0.007157667, + -0.030479966, + -0.015507351, + 0.016710507, + -0.0035426274, + 0.0055534584, + -0.023974007, + 0.010772707, + -0.0064224047, + -0.0016042087, + 0.015540771, + 0.03400031, + -0.01615349, + -0.027115583, + 0.023327868, + 0.015407087, + -0.014515861, + -0.0151174385, + -0.02209129, + -0.0001199327, + 0.026424881, + 0.01151911, + 0.024129972, + 0.00826613, + -0.022859974, + -0.01219867, + -0.031126104, + -0.0027307754, + -0.034735575, + 0.04549714, + -0.012744547, + 0.004812626, + -0.029544177, + 0.014415598, + 0.014081387, + -0.024486464, + -0.0020428596, + -0.004784775, + 0.03789943, + -0.016276034, + 0.018225593, + 0.007948631, + -0.018804891, + -0.0067343344, + -0.029833825, + -0.009530559, + 0.024776112, + -0.052894324, + 0.028118214, + 0.0037320133, + 0.017891383, + 0.008745166, + 0.0336661, + 0.011374285, + 0.0054504103, + 0.040729076, + -0.009530559, + -0.02936593, + -0.0020038683, + 0.0053585027, + -0.011274022, + 0.045185212, + -0.014994895, + -0.009012533, + 0.028140495, + 0.01677735, + -0.0058208266, + 0.04407118, + -0.025778743, + 0.004060653, + 0.003328176, + 0.0072579305, + 0.013412967, + 0.0032028472, + 0.015986385, + -0.026781373, + 0.028831195, + 0.01155253, + -0.034423646, + -0.009508278, + 0.022648307, + -0.024597866, + -0.032730315, + 0.054008357, + -0.021935325, + -0.01449358, + -0.015941823, + 0.012978494, + 0.009185209, + 0.0010569396, + 0.015596474, + -0.0009692094, + 0.040016096, + 0.008979113, + -0.05164661, + -0.0017142196, + -0.009753366, + 0.009686524, + 0.035493117, + -0.0052526696, + 0.028185055, + -0.045296613, + 0.016342876, + -0.029744703, + 0.02967786, + 0.008138017, + 0.003258549, + 0.017701996, + -0.012376916, + -0.01744577, + 0.004250039, + -0.002126412, + -0.0034869257, + -0.018804891, + 0.050265204, + -0.030903298, + -0.0067510447, + 0.003553768, + 0.0062553, + -0.010276962, + 0.020275416, + -0.017000156, + 0.028764352, + -0.012878231, + -0.00312765, + 0.024753831, + -0.021032957, + -0.03400031, + -0.018593224, + -0.030457685, + 0.020487081, + -0.019640416, + 0.016755069, + 0.024597866, + -0.0063499925, + 0.009430296, + -0.0007902677, + -0.042756617, + 0.028719792, + 0.019618135, + 0.028898036, + 0.00856692, + 0.0027293828, + -0.0021431225, + -0.02929909, + 0.01976296, + 0.0030524526, + 0.010639023, + -0.011118057, + 0.043670125, + 0.02339471, + 0.0063555627, + 0.014861211, + 0.03587189, + -0.023550674, + 0.0016264893, + 0.036785398, + -0.020854713, + 0.00823828, + 0.030457685, + -0.028073652, + 0.032173295, + -0.003294755, + 0.023974007, + 0.0064446856, + 0.012365775, + 0.034356803, + -0.013747177, + -0.017624015, + 0.017646296, + -0.0038796228, + -0.0005267291, + -0.0018855022, + -0.036139257, + 0.018236734, + -0.03752066, + 0.018593224, + 0.010678014, + -0.012777967, + -0.0057149935, + 0.0007888752, + 0.0045285476, + 0.05302801, + -0.07432833, + -0.014749807, + -0.039080307, + -0.013479809, + -0.011574811, + 0.0056648618, + -0.024865234, + 0.048883803, + 0.032396104, + 0.006812317, + -0.02410769, + 0.0015693951, + -0.0056453664, + 0.00016606066, + 0.048037138, + -0.010505339, + -0.010505339, + 0.025890145, + 0.0021848988, + 0.03649575, + 0.050265204, + 0.006494817, + -0.0026207645, + -0.045185212, + 0.02736067, + 0.009029244, + -0.014014545, + -0.026068391, + 0.004392078, + -0.04616556, + -0.013446388, + 0.0027753366, + 0.03324277, + -0.0044394247, + -0.008644902, + -0.03433452, + -0.029878387, + 0.017278664, + -0.00954727, + 0.00989262, + 0.029722422, + -0.0056509366, + 0.025177164, + 0.046566613, + -0.010098716, + -0.012677705, + -0.02410769, + -0.017557172, + 0.021823922, + -0.0008215999, + -0.041687146, + 0.017356647, + 0.009786787, + 0.030457685, + 0.041286092, + 0.009926042, + -0.013379546, + 5.1611096e-05, + 0.031415753, + 0.0021835063, + 0.026246637, + 0.015618754, + 0.013880861, + 0.0049713757, + -0.011184899, + 0.024620147, + -0.01217639, + 0.00858363, + -0.026291197, + 0.003857342, + -0.02470927, + 0.015908403, + 0.0041609164, + 0.0029828255, + 0.0071353866, + -0.02406313, + -0.013791738, + 0.032819435, + -0.0073971846, + 0.037832588, + 0.025065761, + -0.016755069, + 0.006628501, + 0.030078912, + -0.038122237, + 0.008310692, + -0.013424108, + -0.025979267, + -0.023461552, + -0.016342876, + 0.03495838, + -0.024219096, + 0.022269536, + -0.005015937, + -0.013646914, + -0.0409296, + -0.017969366, + 0.0028004025, + -0.03065821, + 0.017434629, + -0.02539997, + 0.009018104, + 0.0072356495, + 0.029633299, + 0.00071576674, + 0.010031874, + 0.0075308685, + -0.017334366, + -0.0013208264, + -0.00079444534, + 0.009474858, + 0.029477334, + -0.0014273558, + 0.001399505, + 0.013468669, + -0.0003241142, + -0.00061237044, + -0.014047966, + 0.02635804, + -0.01811419, + -0.008527929, + 0.014270773, + -0.01217639, + 0.0015220487, + -0.013947703, + -0.0023130127, + 0.00027520116, + 0.012109548, + 0.00020818507, + 0.024486464, + -0.016933315, + 0.04079592, + 0.004149776, + -0.01946217, + 0.01414823, + -0.016632525, + -0.039815567, + 0.0041274955, + -0.0009845274, + -0.009118367, + 0.015518491, + -0.011909021, + 0.022815412, + -0.009313323, + 0.016175771, + 0.033710662, + 0.020888133, + 0.048170824, + 0.011023365, + 0.01910568, + -0.00021131829, + 0.00510506, + -0.011090207, + -0.009279901, + -0.0110122245, + 0.037832588, + 0.0059879315, + -0.010639023, + 0.02733839, + 0.00988705, + 0.006400124, + 0.020230854, + -0.009218629, + -0.00024386897, + 0.017055858, + -0.020008048, + -0.018336996, + 0.006550519, + 0.0076979734, + 0.048571873, + -0.0018743619, + -0.012878231, + 0.03616154, + -0.0051440513, + 0.01910568, + -0.0028742072, + 0.007775956, + 0.00084318436, + 0.034445927, + 0.04315767, + 0.035002943, + 0.022291817, + -0.007313632, + 0.0045898193, + 0.0066452115, + -0.008806437, + 0.0054225596, + 0.019952346, + -0.005798546, + -0.01153025, + -0.00477085, + -0.040729076, + -0.00049504876, + 0.0069070095, + -0.019985767, + -0.011374285, + 0.020810151, + 0.019807521, + -0.061271857, + 0.010293673, + 0.0119647235, + -0.014861211, + 0.030413123, + -0.00955841, + 0.0014635619, + -0.01053876, + 0.006895869, + -0.019974627, + 0.009497138, + 0.021222344, + 0.032752592, + 0.011652794, + -0.0013723504, + 0.003364382, + 0.00826056, + 0.012332355, + 0.029254528, + 0.024820672, + -0.008160298, + -0.0031248648, + -0.014192791, + 0.02406313, + 0.019729538, + 0.041999076, + 0.017222963, + -0.042957142, + 0.0065672295, + 0.052270465, + -0.013546651, + -0.0048516174, + -0.0062107383, + 0.008466657, + 0.010120997, + -0.008349683, + 0.016621385, + -0.022146992, + -0.0388575, + -0.020386819, + -0.041352935, + 0.007658982, + -0.04438311, + -0.013346125, + 0.0064224047, + -0.0066452115, + -0.021333747, + -0.011251741, + 0.030836456, + -0.012421477, + 0.0024090982, + -0.008310692, + -0.0068568783, + -0.012978494, + 0.0020665326, + 0.009825778, + 0.029098563, + 0.037297852, + 0.05111187, + -0.028318739, + -0.012343494, + -0.021901906, + -0.015295684, + 0.019818662, + 0.0006558874, + -0.004080149, + -0.054855026, + 0.03099242, + 0.0052136783, + -0.014415598, + 0.008371964, + 0.012142968, + -6.162e-05, + -0.0067677554, + -0.041642584, + 0.02504348, + 0.027494354, + -0.012956213, + -0.009441436, + -0.002783692, + -0.00034935403, + 0.018682348, + 0.025533656, + -0.01811419, + 0.02273743, + 0.015351386, + -0.035136625, + -0.011402136, + 0.002501006, + -0.047502402, + -0.037052765, + 0.00957512, + 9.190779e-05, + -0.01812533, + -0.014972614, + -0.010672444, + 0.0036373204, + -0.002637475, + -0.021545414, + -0.00239378, + 0.012699985, + 0.024508744, + 0.0042695347, + 0.015607614, + -0.01252174, + -0.0020707103, + -0.0061494666, + 0.051869415, + -0.01483893, + -0.013424108, + 0.019740678, + -0.010416216, + 0.00758657, + -0.014326475, + -0.003659601, + -0.022146992, + -0.007174378, + 0.00923534, + 0.015796999, + 0.026402602, + 0.03097014, + -0.005397494, + 0.027182424, + -0.0077258246, + 0.023751201, + -0.010622312, + -0.009357884, + -0.06060344, + -0.026424881, + 0.0036094696, + 0.0052526696, + -0.042645212, + -0.0077926666, + -0.010639023, + -0.023951726, + 0.0072022285, + 0.023684358, + -0.013747177, + -0.043714687, + -0.014103668, + 0.005071639, + -0.026959619, + -0.004578679, + -0.023639798, + -0.0032084174, + 0.018916294, + 0.0012024603, + 0.015696736, + -0.035938732, + -0.017980505, + -0.0027934397, + 0.037676625, + -0.029499615, + 0.0057818354, + 0.0016473775, + 0.006416835, + 0.0056620766, + -0.01776884, + 0.006494817, + 0.003094229, + -0.007581, + -0.010070866, + -0.005670432, + 0.036852237, + -0.03558224, + 0.014103668, + -0.017880242, + -0.037119605, + -0.01715612, + -0.0055061122, + -0.020353397, + 0.011374285, + -0.024174534, + 0.013591212, + 0.02441962, + -0.039191708, + 0.00789293, + 0.03359926, + 0.0065393783, + -0.018615505, + -0.03417856, + -0.041352935, + -0.028095933, + -0.019818662, + -0.00019634845, + -0.035136625, + -0.022882255, + -0.007842798, + 0.020219713, + -0.006728764, + 0.04875012, + -0.0052805203, + 0.008282841, + -0.016120069, + 0.012432617, + -0.010070866, + 0.03567136, + -0.0103995055, + 0.01940647, + 0.051200993, + -0.008795297, + 0.02473155, + -0.0016613029, + -0.011017795, + -0.017590594, + -0.02470927, + 0.0009037599, + -0.004974161, + 0.013947703, + 0.025199445, + -0.047591522, + -0.023773482, + 0.011463407, + 0.0018492962, + -0.012878231, + -0.02078787, + 0.012878231, + 0.005770695, + 0.0125328805, + -0.037386976, + 0.003294755, + 0.017612875, + 0.009068235, + 0.012544021, + -0.020186292, + 0.03259663, + 0.020164011, + 0.011686214, + 0.017902523, + 0.00034413202, + -0.00029643744, + -0.009140647, + 0.038389605, + -0.009363454, + 0.013268143, + -0.013858581, + 0.005375213, + 0.034780137, + 0.025177164, + -0.0026848214, + -0.028853476, + 0.029031722, + -0.013457528, + -0.014894632, + 0.031215228, + 0.008394245, + 0.018994275, + 0.018593224, + 0.02076559, + -0.012666564, + 0.005999072, + -0.01646542, + 0.004392078, + -0.01549621, + 0.025310848, + -0.01681077, + -0.003425654, + -0.0042806747, + -0.012332355, + 0.030390842, + 0.011251741, + 0.038010832, + -0.009848059, + -0.0015582548, + 0.019350767, + 0.0197741, + -0.021133222, + 0.065326944, + 0.037943993, + -0.011073496, + -0.03723101, + 0.03226242, + 0.020509362, + 0.02566734, + 0.02666997, + 0.0015610398, + 0.01679963, + -0.021333747, + 0.022503482, + 0.007937491, + -0.014192791, + 0.010193409, + -0.010254681, + -0.03259663, + 0.025555935, + 0.023194185, + 0.0050883493, + -0.00012419737, + -0.005464336, + 0.014671825, + -0.0028212906, + 0.029544177, + -0.0072635002, + -0.001176002, + 0.023595236, + -0.014281914, + 0.021266906, + 0.0017323226, + 0.018582083, + -0.046655737, + 0.020197432, + -0.039102588, + -0.0012783537, + -0.03295312, + 0.000485301, + 0.0071298163, + -0.005035433, + 0.004305741, + 0.009719945, + -0.04079592, + 0.011190469, + 0.010995514, + -0.0019161381, + -0.03132663, + -0.027739441, + -0.0004964413, + 0.032485224, + -0.027249267, + 0.00791521, + -0.00626087, + -0.004587034, + 0.016331736, + -0.03433452, + 0.02441962, + 0.00954727, + 0.017746558, + 0.043068547, + -0.0010820053, + -0.031126104, + 0.072055705, + 0.008650472, + 0.0047290735, + 0.0015109084, + -0.0066507817, + 0.026090672, + 0.00759214, + -0.008973543, + -0.023528393, + -0.039035745, + -0.044360828, + -0.00958069, + 0.0016543402, + 0.014816649, + 0.0074584563, + -0.0040996443, + -0.0017782765, + 0.008873279, + -0.012488319, + 0.01646542, + 0.025177164, + 0.03257435, + -0.0059099495, + -0.0107392855, + 0.01546279, + -0.029187685, + -0.035092063, + -0.018515242, + -0.00070706336, + 0.018437259, + -0.022057869, + 0.004252824, + -0.021913044, + 0.00691815, + -0.018570943, + 0.01979638, + -0.00064056943, + -0.017568313, + -0.020253135, + 0.009926042, + -0.019317346 + ], + "Category": "Boutique", + "Tags": [ + "pool", + "free wifi", + "air conditioning", + "concierge" + ] + }, + { + "@search.action": "mergeOrUpload", + "HotelId": "3", + "HotelName": "Gastronomic Landscape Hotel", + "Description": "The Gastronomic Hotel stands out for its culinary excellence under the management of William Dough, who advises on and oversees all of the Hotel\u2019s restaurant services.", + "DescriptionVector": [ + -0.048865054, + -0.020307425, + 0.017633565, + 0.023875887, + -0.04401433, + -0.021689085, + -0.04437217, + 0.011500583, + 0.03840817, + 0.00029058976, + 0.016907945, + -0.009214383, + -0.04512761, + 0.019889945, + 0.020973407, + 0.023040926, + -0.026539808, + 0.050495215, + 0.07152826, + -0.008786962, + -0.009994673, + -0.0053129313, + -0.014601864, + -0.048069853, + 0.021231845, + 0.022066806, + -0.018021226, + -0.010526463, + 0.07220418, + 0.0068685417, + 0.009472823, + -0.023239726, + 0.040276892, + 0.03399481, + 0.0156058045, + -0.001837658, + -0.009567252, + -0.03630089, + 0.009010613, + 0.027672967, + -0.023398766, + 0.030078448, + 0.018428765, + -0.006709502, + -0.03598281, + -0.018021226, + -0.017782666, + 0.06655826, + -0.019909825, + 0.010963823, + -0.028428407, + 0.007325782, + -0.030833889, + -0.045724012, + -0.0780489, + 0.024253607, + 0.018220024, + -0.022762606, + 0.056777295, + 0.007817812, + 0.03355745, + 0.029163968, + 0.031967048, + 0.029959168, + -0.051568735, + 0.057294175, + -0.0156157445, + 0.03759309, + -0.046002332, + -0.020396886, + 0.053278416, + 0.016371185, + 0.03170861, + -0.015685324, + 0.0010555041, + 0.024094567, + 0.0051886817, + 0.012872304, + 0.004055521, + -0.03315985, + -0.013568103, + -0.023359006, + -0.072243944, + 0.026480168, + 0.025068687, + 0.009010613, + -0.018090805, + -0.025207847, + 0.009408212, + 0.0025123358, + 0.024591567, + -0.003725016, + -0.0053924513, + -0.025227727, + -0.055385694, + 0.012136743, + -0.011709323, + -0.041310653, + -0.021828245, + 0.04373601, + 0.030217608, + 0.023199966, + -0.012912064, + 0.020277606, + 0.021609565, + -0.031887528, + 0.014164504, + -0.062264178, + 0.03315985, + 0.0034218458, + -0.07550426, + 0.007653802, + -0.04544569, + -0.030973049, + -0.0029298158, + 0.041708253, + 0.053198896, + -0.03379601, + -0.010834603, + 0.025168087, + -0.031569447, + -0.023836127, + -0.025088567, + -0.009935033, + 0.0017009829, + -0.03395505, + 0.03174837, + -0.030814009, + -0.0155958645, + -0.0030192758, + 0.009477792, + -0.024830127, + -0.046757773, + 0.0055216714, + -0.015069044, + 0.024015047, + 0.015735025, + -0.020655327, + -0.020357126, + 0.015287724, + 0.003705136, + -0.03389541, + -0.026142208, + -0.041390173, + -0.03705633, + 0.06818842, + 0.03186765, + 0.007181652, + -0.012802724, + 0.030694729, + 0.025366887, + 0.064729296, + 0.029680848, + -0.011639743, + -0.0016351305, + 0.0029944258, + 0.021788485, + -0.017921826, + -0.03486953, + 0.040992573, + -0.021629445, + 0.03576413, + -0.07232346, + 0.004868116, + 0.055783294, + 0.031112209, + -0.046121612, + -0.049262654, + -0.04500833, + -0.023021046, + 0.03538641, + -0.020536046, + 0.006500762, + 0.031808008, + 0.03359721, + 0.052920576, + -0.017812485, + -0.014949764, + 0.028845888, + 0.019780606, + 0.019999286, + -0.020874007, + 0.0865973, + -0.057691775, + 0.019442646, + 0.03190741, + -0.079122424, + 0.046519212, + 0.018170325, + 0.012196383, + 0.013448824, + 0.009865453, + -0.0850069, + 0.0057204715, + -0.03270261, + 0.051727775, + -0.03242429, + -0.041151613, + 0.012902124, + 0.0003308157, + -0.011937943, + 0.0045102765, + 0.018617624, + -0.016401004, + -0.018369125, + 0.009716352, + 0.0052185017, + -0.024850007, + 0.019880006, + 0.03294117, + -0.004353721, + -0.04373601, + 0.019134505, + 0.0693017, + -0.016222084, + -0.03570449, + -0.050018094, + 0.003702651, + -0.028448287, + 0.047791533, + 0.00023576444, + 0.0012723204, + 0.0047712014, + 0.028030807, + -0.026162088, + 0.06846674, + -0.0069281817, + -0.025963288, + -0.004067946, + 0.011848483, + 0.0010604741, + -0.013090984, + -0.024174087, + -0.029541688, + -0.014224144, + 0.04238417, + 0.007236322, + 0.0034392409, + -0.03447193, + -0.013001524, + -0.03357733, + 0.007017642, + -0.008697502, + 0.011450883, + 0.030058568, + -0.019154385, + -0.014104864, + -0.022822246, + -0.011013523, + 0.024631327, + -0.0059391516, + 0.03238453, + 0.03644005, + -0.028925408, + 0.020774607, + -0.0029447258, + 0.0016053105, + 0.015426884, + 0.041946813, + 0.025426527, + 0.019094745, + -0.000408472, + 0.056061614, + -0.024492167, + -0.012385244, + -0.046996333, + -0.054868814, + 0.030694729, + 0.00025517851, + -0.059918337, + -0.045843292, + 0.0029571508, + -0.0068486617, + -0.03745393, + 0.03638041, + -0.031092329, + 0.0055167014, + 3.5877198e-05, + -0.042145614, + -0.0138861835, + -0.022086686, + -0.03785153, + 0.07232346, + -0.013031344, + -0.018657384, + -0.006461002, + -0.013826543, + 0.029422408, + -0.023716846, + 0.007141892, + -0.0025309732, + 0.0026788306, + 0.011659623, + -0.03838829, + -0.00011531956, + -0.007922182, + 0.022881886, + -0.06938122, + 0.002265078, + -0.0021681632, + -0.023736726, + 0.0750669, + 0.03610209, + -0.014820544, + -0.018041106, + 0.061429217, + 0.003287656, + -0.029800128, + 0.020436646, + 0.022941526, + -0.0022812306, + 0.020237846, + -0.019184206, + -0.0716873, + -0.022066806, + -0.039879292, + 0.014701264, + -0.0058447216, + -0.032245368, + 0.0060137017, + 0.010049343, + -0.021470405, + -0.0050147315, + 0.007718412, + 0.057413455, + -0.023657206, + 0.011798783, + 0.025943408, + -0.009199472, + -0.0021818306, + 0.040952813, + -0.032682728, + 0.018190205, + -0.0026639206, + 0.022444526, + 0.016629625, + -0.015466644, + -0.014800664, + 0.024512047, + 0.0016475555, + 0.014512404, + -0.058327936, + -0.012653624, + -0.010049343, + 0.064331695, + -0.025983168, + -0.010337603, + -0.017971525, + -0.013677443, + -0.010993643, + -0.056817055, + -0.027593447, + -0.009542403, + 0.010009583, + 0.014422944, + 0.014850364, + 0.007609072, + 0.054550733, + -0.011073163, + 0.039839532, + -0.024452407, + -0.024929527, + 0.017822426, + -0.007151832, + 0.014760904, + 0.007256202, + -0.045724012, + 0.009646772, + -0.027692847, + 0.017395005, + -0.007678652, + 0.0056459215, + 0.013220204, + 0.009607012, + -0.064013615, + 0.017116684, + -0.001591643, + 0.008886362, + -0.04234441, + -0.041310653, + -0.0020849155, + -0.04294081, + 0.013478644, + -0.028388647, + -0.010526463, + 0.022265606, + -0.004798536, + -0.014870244, + -0.027573567, + 0.057015855, + 0.04492881, + -0.011560223, + 0.0049749715, + -0.008364513, + -0.011540343, + 0.010228263, + 0.015029284, + 0.052960336, + -0.021331245, + -0.0029397558, + 0.058407456, + -0.04341793, + -0.011083103, + -0.022524046, + 0.03178813, + -0.014661504, + -0.03381589, + -0.055226654, + -0.0069679418, + 0.0030714609, + -0.03801057, + -0.023796367, + 0.008453973, + -0.019015225, + 0.024273487, + 0.007400332, + 0.04262273, + -0.026818128, + -0.0122659635, + 0.004773686, + 0.047155373, + 0.03572437, + 0.03767261, + 0.03482977, + 0.012941884, + 0.018597744, + 0.0012580316, + -0.012216263, + -0.07781034, + -0.03226525, + 0.015019344, + -0.0059987917, + 0.023120446, + 0.057135135, + -0.019989345, + 0.060196657, + -0.020416766, + 0.012434944, + -0.024392767, + -0.021072807, + -0.057612255, + -0.016659444, + -0.04242393, + -0.03741417, + 0.023040926, + 0.051250655, + 0.012434944, + 0.062184658, + 0.011480703, + 0.0044829412, + 0.0021992256, + -0.017723026, + -0.020327305, + 0.021132445, + -0.03870637, + 0.07005714, + 0.019383006, + -0.016540164, + 0.03753345, + -0.03630089, + 0.018786605, + -0.010755083, + -0.022186086, + -0.0048109614, + 0.052284416, + 0.023418646, + -0.011997583, + 0.017563986, + 0.024671087, + -0.013130744, + -0.04520713, + -0.030376649, + 0.04298057, + 0.04266249, + 0.018667325, + -0.03809009, + -0.029621208, + 0.053397696, + 0.041787773, + -0.018776665, + 0.015347364, + -0.004224501, + -0.03628101, + -0.030654969, + -0.024333127, + -0.004423301, + -0.050813295, + 0.021689085, + -0.002314778, + 0.016748905, + 0.008260142, + 0.020476406, + 0.052801296, + -0.004714046, + 0.015814545, + -0.0106358025, + -0.049103614, + -0.027513927, + -0.030913409, + -0.016301604, + -0.008329722, + 0.040833533, + 0.03230501, + -0.050614495, + 0.014492524, + 0.03178813, + -0.011361423, + -0.024472287, + 0.017375125, + -0.018895945, + -0.032245368, + 0.017544106, + -0.017315485, + 0.010437003, + -0.024333127, + 0.020317366, + 0.010685503, + 0.012484644, + 0.011629803, + -0.015874185, + 0.009602043, + 0.001994213, + -0.023895767, + 0.030575449, + 0.036121972, + 0.039680492, + -0.03906421, + -0.028726608, + 0.026818128, + 0.027275367, + -0.018548045, + -0.03502857, + -0.014949764, + 0.03822925, + 0.010347543, + 0.0016599805, + -0.009626892, + -0.021708965, + 0.011669563, + 0.0053328113, + 0.060554497, + 0.003690226, + -0.0015096379, + -0.030257368, + -0.026261488, + -0.0060137017, + -0.03385565, + -0.010054313, + 0.024909647, + -0.024154207, + 0.011232203, + 0.0012617591, + 0.008881393, + 0.03846781, + 0.014939824, + 0.009318752, + 0.048030093, + -0.016351305, + -0.014234084, + 0.019621566, + -0.055504974, + 0.023677086, + -0.021013167, + 0.001827718, + 0.03508821, + 0.003188256, + 0.025585568, + 0.04262273, + 0.0028428407, + -0.026639208, + 0.023319246, + -0.014353364, + -0.014661504, + -0.003752351, + 0.0155958645, + 0.010526463, + 0.012096983, + 0.010745143, + 0.013498524, + 0.049739774, + 0.03357733, + -0.016162444, + 0.023279486, + 0.021152325, + -0.04298057, + 0.013975644, + 0.018329365, + 0.025187967, + -0.017563986, + 0.03592317, + 0.006396392, + -0.007166742, + 0.04512761, + 0.0057055615, + -0.010675563, + 0.006267172, + -0.04302033, + -0.0021656782, + -0.03371649, + 0.026838008, + -0.028567567, + 0.0015270329, + 0.003747381, + -0.011102983, + 0.004674286, + 0.025963288, + -0.008419182, + 0.023100566, + 0.010397243, + -0.025923528, + 0.012723204, + 0.0028030807, + 0.022782486, + 0.011699383, + -0.029979048, + 0.03618161, + -0.0041524363, + -0.007822782, + 0.019363126, + -0.026678968, + -0.048825294, + 0.041787773, + 0.03250381, + -0.0009753628, + 0.0054620313, + 0.017086865, + -0.011679503, + -0.022245726, + -0.010153713, + -0.029641088, + 0.013289784, + 0.023696966, + 0.048109613, + -0.003876601, + -0.0017991405, + 0.020714967, + 0.03528701, + -0.027494047, + -0.017822426, + -0.000420897, + -0.018418824, + 0.024531927, + 0.040634733, + 0.028150087, + -0.010755083, + -0.008439062, + 0.04461073, + 0.007499732, + -0.025863888, + 0.030555569, + -0.028746488, + 0.0027633207, + -0.0028080507, + -0.008106072, + -0.0053924513, + 0.0058099316, + 0.031450167, + 0.023498166, + 0.011490643, + -0.003946181, + 0.007385422, + 0.026639208, + -0.04234441, + 0.0034119058, + -0.047274653, + 0.0052980212, + 0.0026142208, + 0.025207847, + -0.010755083, + 0.012762964, + 0.031132089, + 0.012474704, + 0.022265606, + 0.04282153, + 0.007355602, + 0.0097561125, + -0.016609745, + -0.058009855, + -0.020893887, + -0.029959168, + -0.000963559, + 0.017255845, + -0.020635447, + -0.009129892, + 0.023597566, + -0.023677086, + -0.011659623, + 0.026420528, + 0.024929527, + 0.0015096379, + 0.007286022, + 0.016013345, + 0.029342888, + -0.012494584, + -0.015387124, + -0.046638492, + 0.0005808689, + -0.009020553, + -0.010506583, + -0.0022961407, + -0.0017320454, + -0.019720966, + 0.015188324, + -0.020734847, + 0.001775533, + -0.0022439556, + 0.029919408, + -0.003777201, + 0.06484858, + -0.003720046, + -0.008150802, + -0.015516344, + 0.013786783, + -0.06635946, + 0.007117042, + -0.0049724863, + 0.00073990895, + 0.011102983, + -0.020098686, + -0.0044879112, + -0.017116684, + 0.028547687, + 0.0058149016, + -0.012603924, + -0.03693705, + -0.020317366, + -0.0024029957, + -0.020933647, + -0.024392767, + -0.003772231, + 0.030654969, + 0.010456883, + -0.030873649, + -0.03606233, + -0.008230322, + -0.000918829, + -0.023696966, + 0.001904753, + -0.04512761, + -0.013438884, + -0.025585568, + -0.029183848, + -0.03375625, + 0.010327663, + 0.03242429, + -0.009050372, + 0.008160742, + -0.03427313, + -0.049183134, + 0.029422408, + -0.021987285, + 0.0025819158, + -0.011262023, + 0.014959704, + -0.0020724905, + -0.030953169, + 0.03453157, + -0.0027384707, + -0.011331603, + 0.060156897, + 0.008339662, + 0.00091448025, + -0.039322652, + -0.0013742053, + 0.03226525, + -0.03321949, + -0.002004153, + 0.06556426, + -0.008946002, + -0.023875887, + 0.0012238629, + 0.0013829028, + 0.013717203, + -0.022961406, + 0.026241608, + -0.024452407, + -0.028189847, + -0.020039046, + -0.0018836305, + -0.021430645, + 0.0052532917, + -0.018488405, + 0.011301783, + -0.0059292116, + 0.018319424, + 0.008066312, + -0.0002029935, + -0.024730727, + 0.010745143, + 0.023836127, + 0.022365006, + -0.018518224, + 0.022702966, + -0.007350632, + -0.0015531254, + -0.014025344, + 0.015407004, + -0.017275725, + -0.0014524829, + 0.006441122, + 0.003921331, + 0.0054570613, + -0.010715323, + -0.032483928, + -0.0026564656, + 0.03584365, + -0.0061429217, + 0.012951824, + 0.030992929, + -0.022504166, + 0.00093436026, + 0.017335365, + 0.04508785, + 0.03492917, + 0.007131952, + -0.0028826008, + -0.014442824, + 0.018269725, + 0.021271605, + -0.016053105, + -0.020108625, + -0.029760368, + -0.0052334117, + 0.040833533, + 0.002319748, + 0.0068337517, + -0.014780784, + 0.006769142, + 0.0054471213, + -0.00095424027, + -0.03910397, + 0.023975287, + -0.015198264, + 0.016381124, + 0.022702966, + -0.025923528, + 0.002024033, + -0.009621923, + -0.004868116, + -0.019899886, + 0.019522166, + 0.028329007, + -0.052284416, + -0.0010331391, + -0.027474167, + 0.014830484, + 0.008906242, + 0.03604245, + -0.023557806, + 0.023359006, + 0.0021731332, + -0.008488762, + 0.03659909, + -0.019750785, + -0.016361244, + 0.011729203, + -0.026559688, + -0.015814545, + 0.010516523, + -0.018180264, + -0.065047376, + 0.011550283, + 0.007619012, + -0.07443074, + -0.006709502, + 0.03789129, + -0.007305902, + -0.027692847, + -0.008583193, + 0.014949764, + -0.032006808, + 0.020078806, + 0.061667778, + 0.014015404, + 0.021788485, + 0.0029571508, + -0.0005147058, + 0.0044307564, + -0.015645564, + -0.07121018, + 0.007355602, + -0.014413004, + 0.03286165, + 0.015804604, + -0.0015481554, + 0.030674849, + -0.03640029, + 0.0097561125, + -0.017673325, + -0.013796723, + 0.03387553, + 0.019790545, + 0.026022928, + 0.009010613, + -0.025744608, + -0.0002453938, + -0.022842126, + 0.058447216, + -0.03719549, + 0.027633207, + -0.006774112, + -0.012146683, + 0.016768785, + -0.0045127613, + 0.009462883, + 0.039362412, + -0.03238453, + -0.004000851, + 0.020416766, + 0.018130565, + 0.0082551725, + 0.003792111, + -0.008220382, + -0.0090354625, + 0.016033225, + -0.00014125675, + -0.0026092508, + 0.015715145, + -0.0044009364, + -0.018776665, + -0.011202383, + 0.019522166, + -0.052841056, + -0.00079892774, + 0.041668493, + 0.03737441, + -0.013230144, + 0.021132445, + 0.004219531, + -0.04278177, + -0.018886006, + -0.021251725, + 0.024154207, + -0.009656712, + 0.04274201, + 0.014611804, + 0.001763108, + 0.0098058125, + -0.0060236417, + -0.0017519254, + 0.010864423, + 0.020675207, + -0.021033047, + 0.003993396, + 0.014452764, + -0.03993893, + 0.025466288, + 0.022524046, + -0.008598102, + 0.000807004, + -0.0023185057, + 0.017295605, + -0.012574104, + -0.023796367, + 0.012822604, + 0.025943408, + -0.004463061, + 0.0006352283, + 0.008439062, + -0.008886362, + -0.03353757, + 0.022563806, + -0.000978469, + -0.0009703928, + 0.0013207778, + -0.00025067443, + -0.047513213, + 0.06437146, + 0.010407183, + 0.0008132165, + -0.0051290416, + 0.029959168, + -0.0090652825, + -0.001760623, + 0.019035105, + 0.04329865, + 0.021887885, + 0.025227727, + 0.0029273308, + 0.030654969, + -0.024810247, + -0.022325246, + 0.024551807, + -0.028229607, + 0.031291127, + 0.029303128, + 0.03347793, + 0.020595687, + 0.022643326, + 0.030615209, + 0.03379601, + 0.006272142, + 0.016152505, + 0.0015730055, + -0.03451169, + 0.019293545, + 0.009159712, + -0.0017071954, + -0.011431003, + 0.03816961, + -0.027454287, + 0.024850007, + -0.016798604, + 0.019333305, + -0.0047314414, + 0.03447193, + -0.006421242, + 0.023557806, + 0.029004928, + -0.022126446, + 0.029124208, + 0.016639564, + 0.023060806, + 0.009527492, + -0.047234893, + 0.008667682, + 0.029521808, + 0.014104864, + -0.008444033, + 0.019273665, + 0.022484286, + -0.012504524, + 0.030118208, + 0.0024005107, + 0.0024676058, + -0.0082054725, + 0.026142208, + 0.010198443, + -0.001658738, + 0.021172205, + 0.023995167, + -0.009701443, + 0.0025471258, + 0.03282189, + 0.0058049615, + 0.0027956257, + 0.028428407, + -0.0034243308, + -0.0047960514, + 0.024193967, + -0.0139160035, + 0.012802724, + -0.008369482, + -0.011311723, + -0.031768247, + 0.032762248, + 0.0012226204, + 0.019780606, + 0.010496643, + 0.006510702, + -0.009244203, + -0.0060385517, + -0.007748232, + -0.015844364, + -0.020834247, + 0.0068586017, + 0.012057223, + -0.028309127, + 0.009000673, + -0.0058745416, + 0.015665444, + 0.007161772, + 0.024969287, + -0.040754013, + -0.024034927, + 0.012464764, + -0.041072093, + 0.0082154125, + -0.014711204, + 0.040754013, + -0.006441122, + 0.015377184, + -0.03797081, + -0.024571687, + 0.03170861, + -0.017285665, + -0.026122328, + -0.0013307178, + -0.010794843, + 0.006674712, + -0.004239411, + 0.052204896, + -0.023975287, + -0.0023011107, + -0.03347793, + 0.03162909, + 0.03651957, + -0.024512047, + 0.016560044, + 0.007763142, + 0.003367176, + 0.018647445, + -0.03323937, + 0.0077929622, + 0.015695265, + 0.004028186, + 0.011083103, + 0.016092865, + -0.014263904, + 0.030953169, + 0.002411693, + -0.013627743, + -0.017096804, + -0.0105960425, + -0.031151969, + 0.008752173, + 0.007499732, + -0.03703645, + -0.04524689, + -0.017454645, + -0.009318752, + 0.016331425, + 0.017941706, + 0.052761536, + 0.011331603, + 0.058168896, + 0.049103614, + 0.022424646, + 0.03250381, + 0.009537432, + -0.010934003, + -0.021569805, + 0.007236322, + 0.018895945, + -0.0015779755, + -0.020993287, + -0.008970853, + -0.029462168, + 0.008150802, + 0.012842484, + 0.013200324, + 0.00045506575, + -0.011778903, + 0.011540343, + 0.003225531, + 0.027752487, + -0.009522523, + 0.013727143, + 0.014681384, + 0.010516523, + -0.007867512, + 0.017216085, + -0.0047910814, + 0.003976001, + 0.03735453, + -0.025068687, + 0.04361673, + 0.04321913, + 0.029541688, + -0.0015208204, + 0.0051290416, + -0.0010256841, + 0.026500048, + -0.00057931576, + 0.023160206, + 0.0090354625, + -0.017454645, + -0.04345769, + -0.001827718, + -0.023498166, + -0.008125952, + 0.006217472, + 0.025486168, + -0.019432705, + 0.010407183, + 0.032006808, + -0.03250381, + 0.019373065, + 0.007107102, + -0.006585252, + 0.049183134, + 0.023597566, + 0.026460288, + 0.021271605, + 0.019263726, + 0.012087043, + 0.010864423, + 0.029601328, + 0.006490822, + 0.006341722, + -0.00012300753, + -0.0009902727, + 0.020476406, + -0.03453157, + 0.026539808, + -0.023796367, + -0.0057950215, + -0.003570946, + -0.013776843, + 0.00049513637, + 0.001666193, + 0.047195133, + 0.020377006, + -0.023875887, + 0.003623131, + 0.025724728, + -0.029482048, + -0.007156802, + -0.012832544, + -0.016609745, + -0.011212323, + 0.049501214, + -0.010034433, + -0.010456883, + -0.013329544, + 0.017335365, + -0.023438526, + 0.008657742, + -0.007723382, + -0.006490822, + 0.0023359007, + 0.0059640016, + -0.0138762435, + -0.0053775413, + 0.03479001, + -0.029243488, + -0.011609923, + -0.006242322, + 0.00025347006, + -0.04294081, + -0.025187967, + 0.029482048, + 0.03759309, + 0.013587983, + 0.018687205, + -0.03371649, + 0.017275725, + 5.8242204e-05, + 0.007102132, + 0.007276082, + -0.009790903, + -0.026122328, + -0.03310021, + 0.014174444, + 0.019482406, + 0.030018808, + 0.013458764, + 0.03622137, + -0.029641088, + 0.017166385, + -0.011371363, + 0.03914373, + 0.026360888, + 0.018995345, + -0.006366572, + -0.027036808, + -0.015913945, + 0.023776487, + 0.006719442, + -0.018150445, + 0.007271112, + -0.012882244, + -0.017295605, + -0.026102448, + 0.015735025, + -0.003754836, + 0.0048258714, + -0.022404766, + -0.040913053, + 0.016251905, + -0.030217608, + -0.028309127, + -0.04397457, + -0.03504845, + -0.012395184, + -0.039402172, + -0.019542046, + 0.03584365, + -0.020555926, + 0.0053029913, + -0.030217608, + 0.013170504, + -0.017424826, + 0.04357697, + 0.008439062, + 0.012385244, + 0.021410765, + 0.040594973, + 0.009989703, + 0.021748725, + 0.041429933, + -0.019204086, + -0.013737083, + -0.0055564614, + 0.025068687, + 0.04286129, + 0.00016866942, + 0.025048807, + -0.014234084, + 0.0015904005, + -0.024472287, + -0.003556036, + -0.0011983915, + -0.029541688, + -0.030237488, + 0.012444884, + -0.039760012, + 0.000839309, + 0.022365006, + 0.028786248, + -0.03315985, + 0.025744608, + -0.007067342, + -0.012643684, + -0.026102448, + 0.001646313, + 0.019243846, + -0.023875887, + -0.010735203, + -0.017474525, + 0.0077929622, + 0.04425289, + -0.026181968, + -0.017305546, + -0.018687205, + 0.032086328, + 0.009070252, + 0.017872125, + 0.003565976, + 0.0025844008, + 0.011599983, + 0.027692847, + 0.023140326, + -0.004130071, + 0.03496893, + 0.018051045, + -0.03437253, + -0.011122863, + 0.0053825113, + -0.012534344, + 0.007837692, + 0.030515809, + 0.006207532, + -0.03292129, + -0.011252083, + 0.009830663, + -0.010228263, + 0.013468704, + -0.011878303, + -0.008125952, + 0.04317937, + -0.04536617, + 0.003700166, + -0.016440764, + 0.020635447, + 0.0038964811, + -0.028070567, + -0.015049164, + -0.0051340116, + -0.0041027362, + -0.004299051, + -0.054630253, + -0.0048879962, + 0.0139259435, + 0.017116684, + 0.010387303, + 0.012872304, + -0.019780606, + -0.0017892005, + 0.009020553, + 0.010218323, + 0.032642968, + 0.004818416, + -0.026380768, + 0.0058248416, + 0.040952813, + -0.021828245, + -0.014452764, + 0.0011344028, + -0.03194717, + 0.007857572, + -0.012067163, + -0.0047264714, + 0.0022153782, + -0.0030764309, + -0.021052927, + -0.015983524, + 0.00041685888, + -0.022464406, + 0.0089957025, + -0.03974013, + 0.0022663206, + 0.052284416, + -0.020436646, + 0.026758488, + -0.0027484107, + 0.0056757415, + -0.0058795116, + 0.011093043, + 0.023199966, + -0.00015049786, + 0.012444884, + 0.03296105, + -0.010536403, + -0.011321663, + -0.020029105, + 0.007991762, + -0.041867293, + 0.025863888, + -0.003715076, + 0.016490465, + 0.014333484, + 0.0034566359, + 0.029998928, + -0.003106251, + -0.006257232, + -0.027613327, + -0.023239726, + -0.013230144, + -0.054113377, + 0.03447193, + -0.008001702, + 0.012037343, + 0.009597072, + 0.017554045, + -0.0021905282, + -0.001618978, + 0.0082651125, + -0.0011232203, + -0.007927152, + -0.018478464, + -0.009974793, + -0.019303486, + -0.039600972, + -0.0155859245, + 0.030476049, + 0.017226025, + -0.024313247, + 0.010039403, + 0.004234441, + -0.018707085, + 0.011023463, + -0.018488405, + 0.016798604, + 0.04373601, + -0.024710847, + 0.0069281817, + 0.0028279307, + 0.004015761, + -0.009085163, + 0.0030590359, + -0.0059242416, + -0.010705383, + -0.012653624, + 0.000961074, + 0.011142743, + -0.003352266, + 0.047871053, + -0.04544569, + -0.0015233054, + 0.023875887, + 0.00043021573, + 0.007474882, + -0.017206145, + -0.004443181, + -0.014035284, + 0.018001346, + 0.0011685715, + -0.020635447, + 0.0014760904, + 0.027832007, + 0.015397064, + -0.031489927, + 0.015327484, + 0.014015404, + 0.013518404, + 0.028905528, + -0.024690967, + 0.024810247, + -0.026181968, + -0.015317544, + 0.010993643, + 0.011450883, + 0.030297128, + 0.009920123, + -0.020068865, + 0.0053029913, + 0.015108804, + 0.0007604102, + -0.019144446, + -0.017365186, + 0.003215591, + 0.0025148208, + -0.023975287, + 0.004709076, + -0.021390885, + -0.012027403, + 0.024869887, + -0.028905528, + -0.03638041, + 0.0043015364, + -0.029859768, + 0.006232382, + -0.0069629718, + -0.0024464831, + 0.013120804, + 0.031231489, + 0.0082154125, + 0.0013232628, + 0.0028552657, + -0.009219352, + 0.019144446, + -0.006774112, + 0.0034094208, + -0.03500869, + 0.026221728, + -0.026718728, + 0.03735453, + 0.0155958645, + -0.0059242416, + -0.023677086, + -0.014691324, + 0.013359364, + -0.004299051, + 0.016500404, + 0.009209412, + 0.004085341, + -0.010774963, + -0.004738896, + 0.016490465, + -0.027315127, + 0.021033047, + -0.03445205, + 0.031092329, + 0.006749262, + -0.008806842, + -0.008056372, + -0.04441193, + 0.014184384, + -0.0155859245, + 0.016560044, + 0.007375482, + 0.011440943, + -0.026162088, + -0.018120624, + -0.012772904 + ], + "Category": "Suite", + "Tags": [ + "restaurant", + "bar", + "continental breakfast" + ] + }, + { + "@search.action": "mergeOrUpload", + "HotelId": "4", + "HotelName": "Sublime Palace Hotel", + "Description": "Sublime Palace Hotel is located in the heart of the historic center of Sublime in an extremely vibrant and lively area within short walking distance to the sites and landmarks of the city and is surrounded by the extraordinary beauty of churches, buildings, shops and monuments. Sublime Cliff is part of a lovingly restored 19th century resort, updated for every modern convenience.", + "DescriptionVector": [ + -0.05908324, + 0.007784768, + 0.027741672, + -0.007171661, + -0.027066693, + -0.017335733, + -0.014467069, + -0.03316401, + 0.0033411505, + -0.017594475, + 0.0030992825, + 0.00602982, + -0.018033212, + -0.02180185, + -0.0069016693, + 0.05395339, + -0.0099728275, + 0.023466801, + 0.05804827, + 0.06452808, + -0.02112687, + -0.046708606, + -0.012149638, + -0.011530906, + -0.007773518, + 0.025784232, + -0.045516144, + -0.027269186, + 0.054538373, + 0.027021695, + 0.0035492692, + -0.024434272, + 0.06308812, + 0.011137168, + 0.019023184, + 0.0043283086, + 0.00014492733, + -0.013240855, + 0.0066485517, + -0.0035548941, + -0.012633373, + -0.026864199, + -0.001743698, + -0.008364126, + -0.02483926, + 0.023646794, + -0.016593255, + 0.06268313, + -0.0013612094, + 0.03617892, + 0.012138388, + -0.011868396, + -0.02920413, + -0.03386149, + -0.02951912, + -0.011542156, + 0.016615754, + -0.041376267, + 0.029789113, + 0.00015046426, + 0.024254277, + -0.007014166, + 0.004055504, + 0.03660641, + -0.067093, + 0.036696404, + -0.049903512, + 0.023601796, + 0.0068566706, + -0.015918275, + 0.019428171, + 0.0022274335, + -0.01409583, + 0.0017633849, + 0.026909199, + 0.0051185973, + 0.029766612, + 0.034581468, + -0.012228386, + -0.042343736, + -0.042096246, + 0.0267967, + -0.00058568566, + 0.08225755, + -0.02040689, + 0.0015960461, + -0.04733859, + 0.03982381, + -0.032691527, + 0.031701554, + 0.06808297, + -0.01509705, + -0.055573344, + -0.01741448, + -0.034401473, + -0.02987911, + 0.012127139, + -0.0035323948, + -0.0368314, + 0.0536834, + 0.036741406, + -0.09971703, + -0.0013823025, + -0.04958852, + 0.015142049, + 0.013128359, + 0.048418555, + 0.0013963646, + 0.01040594, + -0.03660641, + -0.09305722, + 0.01273462, + -0.04517865, + 0.008679116, + -0.004381744, + 0.010186572, + 0.03327651, + 0.004845793, + -0.015592035, + 0.013848337, + -0.021565607, + 0.008515996, + -0.023241807, + -0.0137470905, + 0.013297103, + -0.046933603, + 0.038698845, + -0.058813248, + -0.016222017, + -0.044661168, + -0.010642183, + -0.030351596, + -0.043783695, + -0.015209546, + 0.02618922, + 0.036291417, + 0.00054314785, + -0.012768369, + -0.03219654, + -0.039036337, + -0.0035633312, + 0.0038558226, + -0.032691527, + 0.0069860416, + -0.025289247, + 0.03552644, + -0.02751668, + -0.013218356, + -0.036403913, + 0.047563583, + 0.013915835, + 0.03863135, + -0.017943215, + -0.008487872, + -0.056518316, + -0.023916787, + 0.01573828, + -0.035076454, + -0.021621855, + 0.056788307, + -0.046843603, + -0.019158179, + -0.04088128, + -0.030014105, + 0.011289039, + 0.0141408285, + -0.045763634, + 0.022713073, + -0.056833304, + -0.014005832, + 0.037416384, + -0.0040639415, + 0.005188908, + 0.041646257, + 0.025986725, + -0.00163542, + 0.029001635, + -0.0070647895, + -0.020103151, + 0.02411928, + 0.0058160764, + -0.023399303, + 0.08320252, + 0.006839796, + 0.040498793, + 0.0013471473, + -0.022094341, + 0.019551918, + -0.01407333, + 0.037776373, + 0.012464629, + -0.029766612, + -0.040431295, + 0.032309037, + -0.01943942, + 0.011902145, + -0.036066424, + 0.047788575, + -0.02848415, + -0.027561678, + -0.042793725, + -0.016075771, + 0.040431295, + 0.0017858843, + 0.004474554, + -0.047923572, + 0.04832856, + 0.014107079, + -0.015569536, + 0.017391982, + -0.011401535, + 0.003405836, + -0.009505967, + 0.022420581, + 0.028574148, + 0.00089223904, + -0.008386625, + -0.009460968, + 0.0071097882, + 0.034671467, + -0.023939285, + -0.010372191, + 0.014489568, + 0.02985661, + 0.0023539923, + 0.03311901, + 0.0067272997, + -0.015704531, + 0.00804351, + -0.009775959, + 0.026661705, + -0.028011665, + -0.035863932, + -0.0045983004, + -0.032309037, + -0.0044323676, + 0.015805779, + -0.01056906, + 0.022915566, + -0.00073966547, + 0.028056664, + -0.005388589, + 0.015817028, + 0.005020163, + 0.03226404, + -0.0155020375, + 0.028281657, + -0.007272908, + 0.0026042974, + 0.033096515, + -0.014905806, + 0.024636766, + 0.015569536, + -0.0301491, + 0.0103384415, + 0.014467069, + -0.033411503, + -0.03959882, + -0.00071540836, + -0.020913126, + 0.03890134, + 2.0005507e-05, + -0.011182167, + 0.00074177474, + 0.022656824, + -0.03719139, + -0.0085047465, + 0.024929257, + -0.020508138, + -0.023511799, + -0.033726495, + -0.011924645, + 0.020204397, + -0.03226404, + 0.04124127, + -0.014455819, + 0.0041398765, + -0.021329364, + -0.023376804, + 0.032016546, + -0.021385612, + -0.032646526, + 0.0032877144, + 0.00095059664, + -0.027269186, + 0.0027083568, + 0.03185905, + 0.008060385, + -0.011120293, + 0.014467069, + 0.021104371, + -0.002588829, + 0.0066541764, + -0.011564655, + -0.067093, + -0.010096574, + -0.0135895945, + -0.019968154, + 0.0018618195, + 0.030171601, + 0.0015651096, + -0.000103356295, + 0.038856342, + 0.026751703, + -0.00072208786, + 0.01878694, + -0.01777447, + -0.03485146, + -0.015400791, + 0.004840168, + 0.014107079, + -0.013510847, + -0.0045392397, + -0.047383588, + -0.018291954, + -0.024996756, + -0.021363113, + 0.023601796, + -0.016615754, + -0.048823543, + 0.093147226, + 0.02046314, + 0.0029305376, + 0.026211718, + 0.012149638, + -0.013364602, + -0.0010926237, + 0.0072672833, + -0.006918544, + -0.02411928, + 0.03318651, + -0.035661437, + 0.034288976, + 0.0021810287, + 0.015490788, + 0.00094567495, + -0.010782803, + 0.035053954, + 0.031094072, + 0.024884257, + -0.031994045, + -0.03156656, + -0.00318928, + 0.013229606, + 0.022341834, + -0.013882086, + -0.054223385, + 0.0068172966, + 0.06529305, + 0.013207106, + -0.06686801, + -0.06308812, + -0.036403913, + -0.018280705, + 0.031206569, + 0.032331537, + 0.03455897, + 0.020744381, + -0.04661861, + 0.023534298, + -0.0057007675, + -0.009635338, + 0.0064910566, + 0.033703994, + 0.028619146, + 0.014815808, + -0.029316626, + 0.028371654, + -0.00905598, + 0.028821642, + -0.072627835, + -0.027854169, + 0.0012810555, + 0.006766673, + -0.015693283, + 0.023939285, + 0.04227624, + -0.015367042, + -0.036021426, + -0.039216332, + 0.018854437, + -0.03887884, + 0.04333371, + 0.0028700707, + 0.058228265, + -0.034153983, + 0.035053954, + -0.03262403, + -0.036696404, + 0.023624295, + -0.0036730154, + -0.038811345, + 0.011401535, + -0.0117558995, + 0.027921667, + 0.009162852, + 0.037078895, + 0.031049075, + -0.015592035, + -0.010647807, + 0.015828278, + -0.036088925, + -0.0031639682, + -0.073032826, + 0.0027392933, + -0.05431338, + -0.026549209, + -0.060208205, + -0.023309305, + -0.011969643, + -0.03419898, + -0.03419898, + 0.0234893, + 0.0048289187, + -0.012903365, + -0.0018772878, + -0.024411771, + -0.02245433, + 0.0704229, + -0.0012648841, + 0.055618342, + -0.007846641, + 0.045831133, + 0.011789649, + 0.033636495, + 0.05098348, + -5.387535e-05, + -0.066103026, + -0.027786672, + -0.015018302, + 0.013882086, + -0.04796857, + 0.036696404, + 0.0006243564, + -0.016840748, + 0.050848484, + -0.025064252, + -0.002796948, + -0.03998131, + -0.02886664, + -0.030306596, + -0.058273263, + -0.06403309, + 0.016638255, + -0.0013970677, + 0.05161346, + 0.030711584, + 0.031724054, + -0.02276932, + -0.027561678, + -0.021228118, + 0.0054645245, + -0.012543376, + -0.004603925, + 0.033231508, + 0.018426951, + 0.039306328, + -0.032286536, + 0.020418141, + 0.005022975, + 0.057283293, + -0.010366566, + -0.007863516, + 0.020361893, + 0.027944166, + -0.028101662, + -0.009927829, + 0.05075849, + 0.0017957278, + -0.038158864, + -0.013364602, + -0.027359184, + 0.03212904, + 0.0067272997, + -0.011491532, + -0.072987825, + -0.01644701, + 0.039351325, + 0.023331804, + 0.022893067, + -0.040003806, + -0.025986725, + -0.0006162707, + -0.004345183, + -0.02077813, + -0.03795637, + -0.0040920656, + 0.03883384, + -0.07978262, + -0.030126601, + -0.0035155201, + -0.0037405135, + -0.0014322229, + -0.008589119, + -0.007278533, + 0.064303085, + -0.061153177, + 0.0027491369, + -0.014692062, + 0.020249397, + 0.014703312, + 0.01205964, + -0.040363796, + 0.008009762, + 0.027359184, + 0.014444569, + -0.015614535, + 0.019540668, + 0.02479426, + -0.03154406, + 0.024749262, + -0.020620635, + 0.024096781, + -0.008296628, + 0.016469508, + 0.011305913, + -0.022341834, + -0.015052051, + 0.0108953, + -0.015727032, + 0.023736792, + -0.004927353, + -0.0056023328, + 0.0030430343, + 0.0032905268, + 0.06295312, + -0.041668758, + -0.0184832, + 0.019585665, + -0.011879646, + -0.020710632, + -0.07073789, + -0.02515425, + 0.044661168, + -0.001587609, + 0.015862027, + 0.023196809, + 0.010737805, + 0.023061812, + -0.018865688, + 0.013915835, + 0.032151543, + 0.008251629, + -0.008639743, + -0.00871849, + -0.015637035, + 0.009865955, + -0.005183283, + 0.019900657, + 0.038721345, + 0.043221213, + 0.013252105, + 0.017718222, + -0.015524537, + -0.011902145, + -0.01709949, + 0.009770334, + 0.040656287, + -0.027899168, + 0.016379511, + 0.0020122838, + -0.0022668075, + 0.021149369, + 0.0009787208, + 0.016233265, + 0.015850777, + 0.02283682, + 0.036853902, + 0.009832207, + 0.014557066, + 0.012014641, + 0.013634593, + -0.0094497185, + 0.016537007, + -0.014152078, + -0.01816821, + 0.005664206, + -0.051793456, + -0.017200736, + -0.0009618463, + 0.007914139, + -0.010647807, + 0.026279217, + -0.009235974, + -0.023241807, + -0.02077813, + 0.015052051, + 0.011699651, + -0.005683893, + 0.03390649, + 0.01088405, + 0.022656824, + 0.020969374, + -0.028461652, + 0.024501769, + 0.015445789, + -0.023241807, + -0.007076039, + -0.039013837, + -0.002074157, + -0.02147561, + 0.0041258144, + -0.0054898364, + 0.0027603866, + -0.002393366, + 0.031994045, + -0.009359721, + 0.027111692, + 0.006344811, + -0.01984441, + 0.013859587, + -0.005568584, + 0.014905806, + 0.015355792, + -0.05858825, + 0.0034086483, + 0.0010933268, + -0.026009224, + -0.013634593, + -0.016390761, + -0.00920785, + 0.004547677, + 0.0039992556, + 0.013803339, + 0.0006879873, + 0.050353497, + 0.011401535, + -0.04452617, + -0.034288976, + -0.0028335094, + 0.019068182, + 0.044571172, + 0.026751703, + -0.030104103, + -0.013240855, + 0.0058554504, + 0.036583908, + -0.019326923, + -0.0038501977, + 0.0005192423, + -0.004210187, + 0.025649235, + 0.015648283, + -0.013634593, + 0.0060579446, + 0.015862027, + 0.026549209, + -0.019270675, + 0.048283562, + -0.031994045, + -0.011857146, + 0.024749262, + 0.00888161, + -0.0066598016, + -0.015727032, + 0.024884257, + -0.012892116, + 0.01943942, + 0.00687917, + 0.020823129, + -0.036943898, + -0.001269806, + -0.008949108, + 0.004677048, + 0.001615733, + -0.015670782, + 0.015884526, + -0.010349692, + -0.016998243, + 0.014455819, + 0.068982944, + 0.012554626, + 0.011733401, + 0.022094341, + -5.6380155e-05, + 0.05264843, + 0.0060916934, + -0.07001791, + -0.0047361087, + 0.0038080115, + 0.004952665, + 0.027089192, + -0.03525645, + -0.001378787, + -0.0038980087, + -0.007711645, + -0.0065585542, + 0.031949047, + -0.009517216, + -0.020834379, + 0.011469033, + -0.0063841846, + 0.020496888, + -0.0042608106, + -0.00770602, + -0.007886015, + -0.032669026, + -0.032804023, + 0.0070647895, + -0.026234217, + 0.008397874, + -0.022904318, + 0.022589326, + -0.035728935, + 0.0010891082, + -0.021531858, + -0.0054757744, + -0.04292872, + 0.013240855, + -0.022578077, + 0.020069402, + -6.429008e-05, + 0.008150382, + -0.016357012, + -0.017043242, + 0.031206569, + -0.036313917, + 0.02076688, + 0.023106812, + -0.038743846, + -0.00071927544, + 0.04832856, + -0.009151602, + 0.0055517093, + -0.014995803, + 0.0022316521, + -0.027989166, + -0.020530637, + 0.015670782, + 0.07478777, + 0.0071941605, + -0.01641326, + -0.013454599, + -0.008470997, + 0.0036589534, + -0.012779619, + -0.03426648, + 0.034963958, + -0.0035689562, + -0.014568316, + 0.007436028, + -0.021565607, + -0.021340614, + -0.0028742894, + 0.03284902, + -0.011609654, + -0.015468289, + -0.024569267, + -0.049903512, + 0.031004075, + -0.010979673, + 0.0063223117, + 0.018370703, + -0.0011706682, + 0.03527895, + -0.03485146, + 0.016885746, + 0.0071885358, + -0.013533346, + 0.027044194, + 0.002027752, + -0.006069194, + 0.0025592986, + 0.046573613, + 0.028934138, + -0.0016986993, + -0.021531858, + 0.03896884, + -0.010141573, + -0.029429123, + -0.033748996, + -0.011767149, + -0.031206569, + 0.006294187, + 0.02884414, + -0.015468289, + -0.0060579446, + -0.020688133, + -0.0043901815, + 0.001385115, + 0.034738965, + 0.0075260256, + 0.029789113, + -0.022195589, + 0.0011390286, + 0.03818136, + 0.0031724055, + -0.026954196, + 0.031139072, + 0.028056664, + 0.03246653, + 0.003718014, + -0.01240838, + -0.024996756, + 0.01642451, + 0.005967947, + 0.02720169, + -0.061603162, + 0.0056867055, + 0.019585665, + 0.026571708, + 0.005776703, + 0.00906723, + -0.03554894, + -0.00887036, + 0.038766343, + -0.040993776, + 0.02280307, + 0.055798337, + 0.0024453958, + 0.014129579, + -0.0006855264, + -0.0033608372, + -0.0022091528, + 0.028731644, + -0.023939285, + 0.004536427, + 0.0009745022, + -0.010321567, + -0.010332817, + -0.029316626, + -0.012025892, + 0.014579565, + 0.010214696, + 0.0033242758, + -0.012565875, + -0.008594744, + 0.020204397, + -0.013578345, + -0.05188345, + -0.042073745, + -0.015187047, + -0.008769114, + 0.029001635, + -0.017009493, + 0.014455819, + -0.021340614, + 0.032399032, + 0.010951549, + 0.014827058, + 0.0026872635, + 0.038653847, + -0.016840748, + 0.008954733, + 0.024569267, + -0.039711315, + 0.026729204, + -0.014647063, + -0.015198297, + 0.02954162, + 0.031409062, + 0.0017886966, + 0.037731376, + 0.0043367455, + -0.013702092, + 0.026346715, + 0.005804827, + 0.011969643, + 0.0052873422, + -0.029654115, + -0.054178383, + 0.0018561947, + 0.0026057037, + -0.023579298, + -0.039846312, + 0.03883384, + 0.008527245, + -0.019315675, + 0.008487872, + -0.0049020415, + -0.047158595, + 0.014973303, + 0.0012016048, + -0.017560726, + 0.013454599, + 0.01709949, + 0.005804827, + 0.037708875, + 0.006440433, + -0.043446206, + -0.007076039, + -0.020620635, + -0.0020825942, + 0.02983411, + 0.011778398, + 0.0078072674, + -0.021745602, + 0.049273532, + -0.0051270346, + -0.014287074, + 0.0155020375, + -0.022735571, + 0.0029164755, + 0.030689085, + -0.03755138, + 0.045493644, + 0.013128359, + 0.031724054, + -0.018078212, + 0.00022024734, + -0.030036604, + -0.002812416, + 0.007481027, + -0.03422148, + 0.030599087, + 0.03660641, + -0.022263085, + 0.012093389, + 0.02879914, + -0.004778295, + 0.01274587, + -0.022566827, + -0.025761733, + 0.015963275, + -0.0012782431, + 0.008133507, + 0.00285179, + 0.010630933, + -0.007492277, + 0.028349156, + -0.0335465, + 0.017594475, + -0.01122154, + 0.0060354453, + 0.043356206, + -0.004755796, + -0.019034432, + 0.04092628, + 0.026616706, + -0.03282652, + 0.0027055442, + 0.0109178, + -0.007756644, + 0.011542156, + 0.03991381, + 0.026954196, + 0.025986725, + 0.028731644, + 0.04468367, + 0.017155739, + 0.04661861, + -0.0014350354, + -0.0068341712, + 0.020721883, + 0.01644701, + -0.04868855, + 0.029901609, + 0.011272164, + 0.013038361, + -0.020305645, + 0.007239159, + 0.0058498257, + -0.010147197, + -0.0034367726, + -0.026459211, + 0.016390761, + -0.03788887, + -0.0139045855, + -0.022296835, + -0.00077411754, + -0.012914615, + -0.0267967, + -0.00887036, + -7.852793e-05, + -0.017043242, + -0.0043620574, + 0.006710425, + 0.028641647, + -0.039396327, + 0.058768246, + -0.021340614, + -0.0066935504, + -0.019698163, + -0.0059566973, + -0.036763903, + 0.008864735, + 0.030666586, + 0.03127407, + 0.0023666483, + -0.036583908, + 0.018471949, + 0.050488494, + 0.011823397, + -0.01122154, + 0.006209815, + 0.024884257, + 0.00022516907, + 0.0015862028, + 0.0072222846, + 0.0100797, + -0.01645826, + -0.03386149, + 0.004170813, + 0.006575429, + -0.022094341, + 0.016199516, + -0.011789649, + 0.037686378, + 0.03624642, + -0.024186779, + -0.0083753755, + 0.006963542, + 0.0076328972, + -0.0142195765, + -0.023196809, + 0.012318383, + -0.01274587, + 0.0021866537, + -0.022859318, + 0.00871849, + 0.043131214, + 0.03581893, + -0.01576078, + 0.0017155738, + -0.04394119, + -0.013218356, + 0.0008254441, + 0.015873278, + -0.054133385, + -0.010625308, + -0.018719442, + 0.027021695, + -0.007644147, + -0.029271627, + -0.006350436, + -0.0143770715, + 0.018066961, + 0.018044462, + 0.015243296, + 0.026054224, + 0.0201594, + -0.03932883, + 1.0519096e-05, + 0.007008541, + -0.024096781, + 0.04063379, + 0.03388399, + -0.0010173916, + 0.0067497985, + 0.02920413, + 0.0017563539, + 0.0028771018, + 0.047833573, + -0.0077510187, + -0.04398619, + 0.040048804, + 0.03084658, + -0.023028063, + 0.024276776, + 0.019315675, + -0.0031442812, + 0.039306328, + -0.019068182, + -0.012520877, + 0.005889199, + -0.03381649, + -0.010726555, + -0.0137470905, + 0.0073235314, + -0.02582923, + 0.008988482, + 0.0008395062, + 0.023624295, + -0.03719139, + -0.0055854586, + 0.012678372, + 0.0058160764, + 0.0038080115, + -0.05134347, + 0.00805476, + -0.006440433, + 0.048013568, + -0.0012951177, + -0.006603553, + 0.028889138, + -0.02384929, + -0.023084313, + 0.004300184, + 0.0045589264, + 0.025311746, + 0.026751703, + 0.05237844, + -0.010119073, + 0.00821788, + 0.0044014314, + 0.01745948, + 0.025244247, + -0.01641326, + -0.0054785865, + 0.016278265, + -0.0060523194, + 0.013533346, + -0.009629712, + -0.022015594, + 0.029991606, + 0.0013626156, + 0.00528453, + -0.017346982, + -0.004162376, + 0.033389006, + 0.046708606, + 0.014534567, + 0.014849558, + -0.0218356, + -0.05161346, + -0.01808946, + -0.007644147, + 0.0029474122, + -0.0005048287, + -0.037866373, + 0.04223124, + -0.021295615, + 0.034086484, + 0.020238146, + 0.008144757, + 0.0095790895, + -0.0068285465, + 0.013792089, + 0.00854412, + -0.020654384, + -0.011542156, + -0.027404184, + -0.0035998926, + -0.0028138224, + -0.012363382, + -0.0019419733, + -0.011868396, + 0.0013133984, + 0.021869348, + 0.015884526, + 0.008589119, + 0.0045111156, + -0.008600368, + -0.008549745, + -0.003838948, + -0.037438884, + 0.049498525, + 0.009140353, + -0.018888187, + 0.010619683, + -0.0005090473, + 0.010709681, + 0.0036955148, + -0.0059960713, + 0.01705449, + 0.024209278, + 0.020373143, + 0.033389006, + 0.022341834, + 0.0049161036, + -0.039486323, + -0.0073741553, + 0.03122907, + -0.025649235, + -0.022465581, + 0.010484687, + -0.014107079, + -0.03633642, + 0.0038164486, + -0.030171601, + -0.013454599, + -0.021419361, + -0.01749323, + -0.0010033294, + 0.022015594, + 0.00872974, + -0.049453527, + -0.0120708905, + 0.010900925, + 0.0091347275, + -0.014242075, + -0.019180678, + 0.009854706, + -0.020193148, + 0.03224154, + -0.021565607, + -0.015333293, + -0.00019001386, + 0.009427219, + -0.028304156, + 0.027899168, + 0.011530906, + -0.013533346, + 0.0115196565, + 0.012475878, + -0.014343322, + -0.024681764, + 0.0036955148, + -0.006181691, + 0.01240838, + -0.004350808, + 0.039306328, + 0.035503943, + -0.048733547, + -0.032714024, + 0.022409331, + 0.023511799, + -0.02147561, + 0.004075191, + 0.01642451, + 0.014827058, + -0.0016621379, + -0.020496888, + -0.010962798, + -0.016795749, + 0.0040245675, + -0.023241807, + -0.046078626, + 0.005318279, + -0.005731704, + -0.0005807639, + 0.042861223, + -0.046483614, + -0.01574953, + 0.0026872635, + -0.07321282, + 0.018854437, + -0.011733401, + 0.012678372, + -0.027134191, + -0.028574148, + 0.01879819, + -0.0077678934, + 0.024411771, + 0.03892384, + -0.0048289187, + -0.038406353, + 0.010270944, + -0.00076216477, + 0.023376804, + 0.010878426, + 0.005939823, + 2.8893182e-06, + 0.040296298, + -0.0029614742, + 0.025581738, + 0.011677152, + 0.015659533, + -0.03055409, + 0.006575429, + -0.0010595778, + 0.045763634, + 0.02040689, + -0.00163542, + 0.019529417, + 0.039486323, + 0.008679116, + 0.013184607, + 0.0073629054, + -0.029676614, + 0.008639743, + -0.015007053, + 0.0049779764, + 0.022656824, + 0.0002733317, + -0.07910764, + -0.026684204, + -0.015119549, + -0.008926609, + 0.010293443, + -0.0061535668, + -0.017290734, + 0.006294187, + -0.008594744, + -0.021633105, + -0.02452427, + 0.0018533822, + 0.055933334, + -0.026571708, + 0.024704263, + -0.018831939, + 0.012937115, + -0.008797238, + 0.036988895, + -0.0060523194, + -0.0088197375, + 0.00067603454, + -0.0076666465, + 0.030036604, + 0.01946192, + 0.028934138, + -0.04958852, + 0.0065191807, + -0.008409124, + 0.0068566706, + 0.013364602, + 0.021824349, + 0.026144221, + -0.0014849558, + 0.004812044, + -0.024884257, + 0.03125157, + -0.0184607, + -0.049768515, + -0.013105859, + 0.021621855, + -0.0010982485, + -0.03287152, + -0.005124222, + 0.011249664, + -0.030396594, + 0.008909734, + -0.017920716, + 0.01141841, + 0.011002172, + -0.01776322, + -0.006941043, + 0.024389273, + 0.007239159, + 0.0007818517, + 0.017178237, + 0.028776642, + -0.007925388, + -0.005939823, + -0.030306596, + 0.006305437, + 0.00031903345, + -0.01976566, + 0.0028292907, + -0.028596647, + -0.012644623, + -0.000331162, + -0.007340406, + -0.025896728, + 0.008532871, + 0.0028264783, + -0.02544674, + -0.043221213, + -0.01711074, + 0.022566827, + -0.0014399571, + 0.0070985383, + -0.002553674, + -0.018595695, + -0.008105383, + -0.022049343, + 0.02148686, + 0.005419526, + -0.0052957796, + -0.00528453, + 0.025356743, + -0.016390761, + -0.010062825, + 0.009477843, + 0.07339281, + 0.04124127, + 0.013949584, + -0.0059791966, + -0.002858821, + 0.023354303, + 0.0054364004, + -0.014275825, + -0.026324214, + 0.02483926, + 0.004145501, + -0.009050355, + -0.0067160497, + 0.006603553, + 0.04495366, + -0.0368314, + 0.049543522, + -0.02816916, + 0.00770602, + -0.0015749531, + 0.011424035, + 0.033636495, + -0.0073010325, + 0.012363382, + -0.016480759, + -0.03253403, + 0.015063301, + -0.013960834, + -0.010642183, + 0.0402738, + 0.01473706, + -0.0075147757, + -0.03055409, + 0.008954733, + -0.026369214, + 0.035323948, + -0.02416428, + 0.010479063, + -0.006462932, + 0.02652671, + -0.005427963, + -0.05296342, + 0.005076411, + 0.003574581, + -0.023466801, + 0.0015355792, + 0.009005357, + -0.05908324, + 0.016863247, + 0.011092169, + 0.033456504, + -0.009865955, + 0.03482896, + 0.014838307, + 0.018066961, + 0.027764171, + 0.014287074, + -0.005346403, + -0.014557066, + 0.00974221, + -0.018550698, + 0.006108568, + -0.025604237, + -0.01813446, + -0.017819468, + -0.0092191, + 0.00033872036, + -0.0065360554, + 0.0028911638, + -0.011857146, + 0.029766612, + -0.0011474658, + -0.0038895716, + 0.02447927, + -0.013510847, + 0.014320823, + 0.010495937, + -0.012183387, + -0.00034030236, + 0.0040976903, + -0.018246956, + 0.0369664, + 0.008628493, + -0.0005628348, + 0.0013724591, + -0.012487127, + -0.036156423, + 0.015164548, + 0.0100572, + 0.05233344, + 0.027314186, + -0.007537275, + -0.034693964, + 0.019338174, + -0.0035914555, + -0.009528466, + -0.031116573, + -0.012610874, + 0.029316626, + 0.009674711, + 0.00028387827, + 0.00019106852, + -0.0056051454, + 0.025964227, + 0.0061198175, + 0.0039120708, + 0.037483882, + 0.019315675, + 0.023005564, + -0.0032792771, + 0.013004612, + -0.015547036, + -0.015367042, + 0.002796948, + -0.030171601, + 0.025221748, + 0.02044064, + -0.0059566973, + 0.029361624, + 0.014984554, + 0.05534835, + 0.0011341068, + 0.004277685, + -0.013263355, + 0.013522097, + -0.003810824, + 0.0016579194, + -0.052918423, + 0.022578077, + -0.0038670723, + 0.0023033689, + -0.021025622, + 0.042793725, + -0.0021121246, + 0.024051784, + -0.03757388, + -0.0035858306, + -0.023376804, + -0.0057401415, + -0.008352876, + 0.014320823, + -0.01274587, + -0.03390649, + 0.06637302, + -0.034153983, + -0.0013450381, + 0.014714561, + -0.0056670187, + 0.0035380195, + -0.015580785, + 0.03660641, + 0.044931162, + 0.019191928, + 0.02787667, + 0.0007291189, + 0.031611558, + -0.009607214, + 0.037416384, + 0.005079224, + 0.0064291833, + -0.020631885, + 0.006963542, + 0.02044064, + 0.023376804, + -0.013049611, + -0.030576589, + 0.022105591, + -0.023916787, + 0.021711852, + 0.0468886, + 0.006249189, + 0.006766673, + -0.017346982, + -0.0070310403, + -0.017470729, + -0.01576078, + -0.049408525, + -0.015007053, + 0.035728935, + 0.0071604117, + 0.026616706, + 0.0042945594, + 0.027606677, + 0.016998243, + 0.04967852, + 0.0035183325, + 0.01577203, + -0.016345764, + 0.01644701, + -0.039733816, + -0.016357012, + 0.00078044547 + ], + "Category": "Boutique", + "Tags": [ + "concierge", + "view", + "air conditioning" + ] + }, + { + "@search.action": "mergeOrUpload", + "HotelId": "48", + "HotelName": "Nordick's Valley Motel", + "Description": "Only 90 miles (about 2 hours) from the nation's capital and nearby most everything the historic valley has to offer. Hiking? Wine Tasting? Exploring the caverns? It's all nearby and we have specially priced packages to help make our B&B your home base for fun while visiting the valley.", + "DescriptionVector": [ + -0.06868838, + -0.01605626, + 0.03267631, + 0.005335447, + -0.03286424, + -0.012896689, + 0.04641868, + 0.04179091, + -0.011739746, + 0.010717876, + -0.014094742, + 0.017618427, + -0.043952104, + 0.013507461, + 0.038666576, + 0.03366294, + 0.007687507, + 0.040592857, + 0.04291849, + 0.023244578, + -0.026427642, + -0.01954471, + -0.04961349, + 0.0071707, + 0.05722465, + -0.01691369, + -0.011446105, + 0.015292794, + 0.002882081, + -0.04900272, + -0.030256713, + -0.036199994, + -0.025370535, + -0.058822054, + -0.008997143, + 0.04468033, + -0.0004114637, + -0.014646786, + 0.011610543, + 0.009643152, + -0.0017794612, + 0.025605448, + 0.0058405087, + -0.025957815, + -0.0032182995, + -0.010265671, + 0.012767487, + 0.04561998, + -0.026474623, + -0.0195682, + -0.03422673, + -0.05398286, + -0.047146913, + -0.05966774, + -0.03704568, + 0.026944447, + -0.030890975, + -0.02050785, + 0.024430886, + 0.013671899, + 0.029035168, + -0.022962684, + 0.017418751, + 0.05619104, + 0.005655515, + 0.047945615, + -0.0013507461, + 0.018792989, + -0.0045925365, + -0.00863303, + 0.013190329, + 0.03953575, + -0.018699024, + 0.0048949863, + 0.035424784, + 0.030632572, + -0.0168902, + -0.040029068, + -0.008950161, + -0.038267225, + -0.0026530414, + -0.019098375, + 0.03345152, + -0.0034678937, + -0.017219076, + -0.0399351, + 0.009443477, + 0.036223486, + -0.019603437, + -0.0021655983, + 0.026357166, + 0.0006882198, + 0.020601815, + -0.05356002, + -0.030444643, + 0.045925368, + 0.03305217, + -0.0019248131, + -0.034320697, + 0.05703672, + 0.027014922, + -0.058963004, + 0.002802798, + 0.0004624837, + 0.046230752, + 0.023044903, + 0.048157036, + 0.06469487, + 0.015163593, + 0.008327643, + -0.078225814, + -0.009519824, + -0.002112743, + 0.03042115, + -0.022116998, + 0.04028747, + 0.0050829165, + -0.03267631, + 0.02621622, + 0.01841713, + -0.01273225, + -0.010988026, + -0.042025823, + -0.032981697, + -0.007769726, + -0.029434519, + -0.05153977, + 0.02452485, + -0.03596508, + -0.02605178, + 0.008680012, + -0.03037417, + 0.09894509, + 0.024407394, + -0.0043135784, + -0.017453989, + -0.0019982234, + -0.0076757614, + -0.030045291, + 0.014764242, + -0.00015939171, + -0.011493088, + 0.013084618, + -0.009308402, + 0.038666576, + 0.053841915, + 0.004842131, + 0.011363885, + 0.0076816343, + 0.025887342, + -0.00080897944, + 0.020190718, + -0.009960284, + -0.031031923, + -0.055768196, + -0.026098764, + -0.021623682, + 0.023949316, + -0.012039259, + 0.05050616, + -0.032253467, + 0.007147209, + 0.021964306, + -0.036505383, + 0.023902332, + 0.012238934, + -0.011093737, + 0.014364891, + -0.042260733, + -0.018511094, + 0.012556066, + -0.035354313, + 0.011328649, + 0.011880693, + 0.0025532038, + 0.013436987, + 0.011011517, + 0.03396833, + -0.0054910765, + -0.0065716733, + 0.013566189, + -0.015175339, + 0.023174105, + -0.014987409, + -0.014494093, + 0.00067757536, + 0.003629396, + 0.039394803, + -0.026920957, + 0.016878454, + -0.044962227, + -0.021130366, + -0.024924202, + 9.87366e-05, + 0.0007553901, + -0.03453212, + -0.009901556, + -0.010988026, + 0.0175597, + 0.028706292, + -0.054781564, + -0.03248838, + 0.07333964, + -0.04545554, + -0.043364823, + -0.027531728, + 0.018099997, + 0.010805969, + -0.00055718276, + -0.019450745, + -0.0034355933, + 0.029575467, + 0.025605448, + 0.036129523, + 0.012180206, + -0.030115765, + -0.044750806, + 0.042707067, + 0.021012912, + 0.007963529, + -0.04616028, + 0.01538676, + 0.022739517, + 0.053043213, + 0.047828157, + 0.034320697, + -0.03934782, + -0.018569821, + 0.015809601, + -0.0087269945, + 0.021435753, + -0.03495496, + -0.022669043, + -0.008151459, + -0.032605834, + 0.024642307, + 0.018992664, + -0.0010541693, + 0.01235639, + -0.010083613, + -0.055016477, + -0.029011676, + 0.0305621, + 0.033733416, + 0.0067830947, + -0.01672576, + 0.005720116, + -0.021752885, + 0.053137176, + 0.018511094, + -0.048039578, + -0.015398505, + -0.01908663, + -0.0436937, + -0.014999154, + 0.023385527, + -0.02093069, + 0.0044457163, + 0.026920957, + -0.01624419, + 0.026451131, + 0.033991817, + -0.02562894, + -0.018605059, + -0.010835333, + -0.021987798, + 0.025159115, + -0.0039670826, + -0.025417518, + -0.054640617, + -0.034649573, + -0.029998308, + 0.006178195, + -0.010571056, + -0.0006595899, + -0.044774298, + -0.0032036174, + -0.020472612, + 0.04312991, + -0.007746235, + -0.010300907, + 0.0023359098, + 0.0032388542, + 0.015398505, + -0.030233221, + -0.021905579, + 0.04103919, + 0.038431663, + -0.019438999, + -0.006548182, + -0.04564347, + 0.03702219, + -0.009831082, + -0.009883937, + 0.028588835, + -0.01986184, + 0.028729782, + -0.031501748, + 0.020519596, + 0.021153858, + -0.0059051095, + 0.04157949, + 0.017994286, + 0.0043429425, + 0.03171317, + 0.014000777, + -0.021071639, + -0.008186696, + 0.0010460941, + 0.021999544, + 0.019215832, + 0.023068395, + -0.0129084345, + 0.005746544, + 0.018746007, + -0.038807523, + -0.06173497, + -0.020590069, + 0.063520305, + -0.025417518, + 0.036975205, + 0.02562894, + 0.008433354, + -0.0055997237, + -0.046089806, + -0.013166838, + 0.052385457, + -0.021494482, + -0.0025047532, + -0.009284911, + 0.027085396, + -0.021529717, + -0.02833043, + 0.05600311, + -0.01900441, + -0.015046136, + -0.038995452, + -0.011440232, + 0.03840817, + 0.059385847, + -0.05168072, + -0.010148214, + -0.036223486, + 0.009478714, + -0.026192728, + 0.039629716, + 0.008398117, + 0.029223097, + 0.0071237176, + -0.0039230366, + -0.07084957, + 0.001154741, + 0.0012428332, + 0.020672288, + -0.0023917016, + -0.007998766, + 0.053700965, + -0.044586368, + -0.033334065, + 0.0024504296, + -0.029411027, + -0.012180206, + 0.02983387, + -0.017512716, + 0.012720505, + 0.03706917, + 0.019239323, + 0.004977206, + -0.0034091657, + -0.01281447, + 0.03020973, + -0.0032417907, + 0.01262654, + -0.0025091576, + 0.018581567, + 0.053653985, + 0.06577546, + 0.011804346, + -0.0054176664, + -0.01758319, + -0.016385138, + -0.031478256, + 0.018276181, + 0.0033298829, + 0.047640227, + -0.05698974, + 0.011857201, + -0.046653595, + -0.061828934, + 0.006430726, + 0.039700188, + -0.0132373115, + -0.06333237, + -0.008685885, + -0.024242956, + -0.032605834, + 0.029199608, + -0.015363269, + -0.0053824293, + 0.045126665, + 0.027531728, + -0.03514289, + -0.058070336, + -0.014905189, + 0.012591302, + 0.0170194, + -0.012509083, + -0.03363945, + -0.02605178, + 0.02508864, + -0.014881698, + -0.055768196, + 0.052291494, + -0.040733803, + 0.01034789, + 0.03685775, + -0.015797857, + -0.037585977, + 0.03587112, + -0.022175727, + 0.0123328995, + 0.059714723, + 0.015504216, + -0.00021142112, + -0.06572848, + 0.0016796234, + 0.02945801, + -0.013319531, + -0.08395768, + -0.026944447, + -0.0009792909, + -0.02230493, + 0.036740292, + 0.062862545, + 0.00403462, + 0.010048376, + -0.06474185, + -0.014447111, + 0.014752496, + -0.007664016, + 0.0070003886, + -0.029129133, + -0.05191563, + 0.012485592, + 0.031854115, + 0.009696008, + 0.03897196, + -0.0019321542, + -0.01747748, + -0.030820502, + 0.019204086, + -0.027813625, + -0.03345152, + -0.04620726, + -0.00024555682, + 0.03932433, + 0.00018701227, + -0.01793556, + 0.019626928, + -0.018053016, + 0.01726606, + 0.008797468, + -0.046653595, + 0.013472224, + -0.00175597, + -0.039817646, + 0.0058170175, + 0.011810219, + 0.025605448, + -0.049378578, + 0.005203309, + -0.028212976, + -0.01586833, + -0.008386372, + -0.039230365, + -0.015997533, + -0.05891602, + 0.040216997, + -0.033733416, + -0.01720733, + 0.002265436, + -0.004586664, + -0.0042284224, + 0.039606225, + -0.00702388, + -0.104395054, + -0.02385535, + -0.010835333, + -0.06704399, + -0.028424395, + 0.039206874, + 0.014916935, + -0.019626928, + -0.01064153, + 0.010300907, + 0.027296817, + -0.05088202, + 0.044327963, + 0.043482278, + -0.014458856, + -0.0065775462, + -0.038619593, + 0.017042892, + 0.00021637631, + 0.007687507, + -0.0063308883, + 0.014517584, + 0.013260803, + 0.0008574301, + 0.021048147, + -0.013272548, + -0.015457233, + -0.0043634973, + -0.006048993, + -0.0074643404, + 0.013354768, + 0.0074291034, + 0.027461255, + 0.004008192, + 0.046818033, + 0.021153858, + 0.013225566, + 0.010506456, + 0.0044310344, + -0.019955805, + 0.03481401, + 0.009543315, + -0.039512258, + 0.031595714, + 0.0008449504, + -0.018652042, + -0.019603437, + -0.033005185, + -0.00601082, + -0.010130595, + 0.049331598, + 0.0071824454, + -0.018769497, + 0.013906812, + 0.01804127, + 0.002895295, + 0.00038063145, + -0.011628162, + 0.01538676, + -0.00027749024, + -0.027226344, + 0.00060526637, + 0.020601815, + 0.012708759, + 0.012931925, + -0.003629396, + 0.051962614, + -0.02945801, + -0.024172483, + 0.017512716, + 0.0037292338, + -0.0057582892, + 0.014541076, + -0.022845227, + 0.011974658, + 0.010342017, + 0.0029716415, + 0.024830237, + 0.008450972, + 0.057271633, + 0.02184685, + 0.034297206, + 0.037867874, + -0.014353146, + -0.017042892, + 0.024618816, + 0.037092663, + -0.0054763947, + -0.00027969253, + 0.05417079, + 0.0008383435, + 0.032840747, + -0.041438542, + -0.017324787, + 0.00765227, + 0.006307397, + -0.00034245817, + -0.018945683, + -0.008544937, + -0.0019747321, + -0.061687987, + 0.026944447, + -0.041250613, + -0.0024871347, + -0.0019497726, + -0.025347045, + 0.025981307, + 0.0021465118, + 0.0050858525, + -0.013601426, + -0.0066245287, + -0.0010049845, + -0.04009954, + -0.039042436, + -0.017148603, + 0.013577934, + -0.01798254, + 0.0047011836, + 0.016326409, + -0.021705903, + -0.007164827, + -0.0215767, + 0.018546332, + 0.00631327, + 0.0050418065, + 0.0031889353, + -0.011181829, + 0.028541852, + -0.01795905, + -0.0026222093, + 0.02098942, + -0.019826604, + -0.009836955, + -0.022763008, + -0.016878454, + 0.04580791, + -0.010676767, + -0.0058757453, + 0.015844839, + 0.0023461871, + 0.02640415, + -0.01793556, + -0.04291849, + -0.008186696, + -0.009226183, + -0.0026780008, + 0.05722465, + 0.049472544, + -0.040216997, + -0.028283449, + -0.01871077, + -0.009754736, + -0.002808671, + -0.018428875, + -0.012943671, + 0.014411873, + 0.018781243, + -0.0064718355, + 0.008544937, + -0.0050917254, + 0.018804735, + 0.015927058, + -0.003905418, + -0.01833491, + -0.03932433, + 0.019615183, + 0.028447887, + 0.01292018, + 0.01795905, + 0.012051004, + 0.027860606, + -0.008169077, + -0.020519596, + -0.033287082, + -0.0003586084, + 0.0010805968, + 0.017677156, + -0.015363269, + 0.03114938, + 0.00601082, + -0.0024093199, + 0.006800713, + -0.0116810175, + -0.02335029, + 0.044562876, + 0.05929188, + 0.024665799, + 0.020178972, + 0.0012443014, + -0.000754656, + 0.009185073, + 0.04446891, + 9.937894e-05, + 0.020860218, + 0.0059491554, + 0.050929, + -0.0029877916, + -0.0075583053, + 0.039841138, + -0.020061515, + -0.02098942, + 0.017806357, + -0.0017089874, + 0.0015445488, + -0.004636583, + -0.011181829, + -0.024289938, + 0.0037938347, + 0.011980531, + 0.033287082, + -0.02887073, + -0.023127122, + -0.022563333, + 0.019450745, + -0.091474876, + 0.00072272256, + -0.028706292, + 0.02042563, + -0.023608692, + 0.0017941432, + -0.029223097, + -0.023902332, + -0.017066384, + 0.014576312, + -0.017042892, + -0.02393757, + -0.019027902, + -0.034673065, + 0.0037321702, + -0.017089874, + -0.034696557, + -0.021459244, + -0.004848004, + 0.018652042, + -0.050036334, + -0.025347045, + 0.027813625, + -0.0012068623, + 0.0019262814, + -0.00055057585, + 0.012156715, + 0.015985787, + -0.04942556, + -0.00038283374, + 0.07733315, + 0.025159115, + -0.031501748, + 0.01139325, + 0.045103174, + 0.011316903, + 0.011669272, + -0.003861372, + -0.0082336785, + -0.057459563, + -0.025206096, + 0.015551198, + 0.015410251, + 0.003723361, + -0.008245424, + 0.016467357, + -0.00859192, + 0.02927008, + -0.025558464, + -0.07315171, + 0.021553209, + -0.013601426, + 0.008022257, + -0.013824592, + -0.03666982, + 0.014317908, + -0.026920957, + 0.004298896, + 0.013319531, + -0.0027969254, + -0.004122712, + -0.007875437, + -0.013178583, + -8.2448736e-05, + 0.03516638, + -0.0038525627, + 0.050083317, + 0.008409862, + 0.025981307, + -0.018323164, + -0.030632572, + 0.0065658004, + 0.035048924, + -0.03363945, + -0.029669432, + 0.012884943, + -0.0032770275, + 0.016984165, + -0.050224263, + 0.017007655, + -0.019579945, + 0.046771053, + -0.004798085, + -0.0046835653, + -0.00010837168, + -0.0041843764, + 0.019016156, + 0.00075612415, + -0.015797857, + 0.016114987, + 0.0018337846, + -0.019180594, + -0.0313608, + 0.02544101, + -0.056378968, + 0.009696008, + -0.045901876, + -0.005582105, + -0.05647293, + 0.028894221, + 0.025605448, + 0.042307716, + -0.025041658, + 0.028259957, + -0.029622449, + 0.039441787, + -0.0056525785, + -0.033287082, + -0.02640415, + -0.004921414, + -0.037398048, + -0.012191951, + -0.0125795575, + -0.0019468362, + -0.030350678, + 0.032441396, + 0.021811614, + -0.021705903, + 0.012426864, + 0.037867874, + -0.011510706, + -0.026897466, + 0.013507461, + -0.03589461, + 0.0037145517, + -0.019333288, + -0.016526084, + -0.0012949544, + 0.0021024656, + -0.014576312, + -0.05910395, + -0.03154873, + 0.003077352, + 0.022234455, + 0.0038231986, + -0.014364891, + -0.0034062292, + 0.018111743, + 0.0209072, + 0.014846462, + 0.03683426, + 0.035283837, + 0.022023033, + 0.005869873, + -0.023679167, + 0.0011143655, + -0.032464888, + 0.023808368, + 0.0077403625, + -0.006882932, + -0.008803341, + 0.0039142272, + 0.010753114, + -0.009143963, + 0.026075272, + -0.022187473, + -0.023925824, + 0.00034355934, + -0.016279427, + 0.028823746, + -0.011769109, + -0.007628779, + -0.034461644, + 0.0023872969, + 0.043035947, + 0.007922419, + 0.016173717, + 0.013472224, + 0.00015535415, + -0.026756518, + 0.029434519, + -0.07380947, + -0.021917323, + 0.034508627, + 0.024853729, + -0.009766482, + -0.037679944, + 0.009613789, + -0.041180138, + 0.016114987, + -0.033615958, + 0.0134839695, + 0.017771121, + -0.0013903875, + 0.02034341, + 0.0035970956, + 0.016279427, + 0.003033306, + 0.045878384, + 0.024642307, + 0.021071639, + -1.6804033e-05, + -0.00015691412, + 0.018428875, + 0.014975663, + -0.017242568, + 0.01425918, + 0.012931925, + 0.040804278, + -0.024289938, + 0.032206483, + -0.00034245817, + -0.006172322, + -0.015057882, + 0.018276181, + 0.001198053, + -0.018781243, + -0.012532575, + 0.02109513, + -0.010083613, + -0.051304862, + -0.010130595, + -0.055909142, + 0.0001237878, + 0.029974818, + 0.009772355, + 0.009519824, + -0.021635428, + 0.03627047, + -0.021377025, + -0.02385535, + -0.01881648, + 0.018064762, + -0.022363657, + 0.039982084, + 0.009108727, + -0.005050616, + -0.016044514, + -0.020543085, + 0.020719271, + -0.0029305317, + -0.0012773359, + -0.008820959, + -0.005567423, + -0.009725372, + 0.04052238, + -0.0064542172, + 0.02736729, + 0.01191593, + -0.0049390323, + 0.01262654, + -0.025511483, + -0.04031096, + 0.03589461, + -0.05017728, + -0.008944288, + 0.013519206, + -0.006912296, + -0.010712003, + 0.021705903, + -0.017219076, + 0.019274559, + -0.0003224539, + 0.0093025295, + -0.00031052477, + -0.025910834, + 0.047240876, + 0.020648796, + 0.0073586297, + -0.014129979, + -0.015645163, + 0.0037850256, + -0.019709148, + 0.014376637, + -0.009167455, + 3.854031e-05, + 0.0013030295, + 0.038478646, + 0.008832705, + 0.021153858, + 0.023843605, + 0.010571056, + 0.009977902, + 0.002569354, + -0.004980142, + -0.00884445, + 0.005438221, + 0.039817646, + 0.023456, + -0.023714403, + -0.048204016, + 0.028823746, + 0.06056041, + -0.007658143, + 0.03227696, + -0.0064718355, + 0.018792989, + -0.036340944, + 0.019204086, + 0.03495496, + -0.013707137, + 0.008433354, + -0.016326409, + 0.012191951, + -0.014482347, + 0.013648408, + 0.009143963, + 0.026873974, + 0.047381822, + -0.007294029, + -0.0032946458, + -0.008909051, + -0.03441466, + -0.0071119717, + 0.0075876694, + 0.0033063914, + 0.027108887, + -0.009014762, + 0.032958206, + 0.0031155252, + 0.0041990583, + 0.0170194, + -0.04294198, + -0.017759375, + 0.015856585, + -0.040545873, + -0.00418144, + -0.030890975, + 0.0044545257, + -0.006788967, + 0.024266448, + 0.034461644, + -0.0123328995, + -0.013765864, + 0.016584814, + 0.007006261, + -0.029763397, + 0.014705514, + -0.009619662, + -0.0009257015, + 0.002184685, + -0.028400905, + 0.0006540841, + -6.4119145e-06, + 0.01954471, + 0.016984165, + -0.001952709, + -0.0066186558, + -0.0114343595, + -0.006031375, + 0.024172483, + -0.014846462, + -0.006066612, + -0.0007447456, + -0.014881698, + -0.014188707, + 0.016561322, + 0.013671899, + 0.035072416, + 0.023150614, + 0.05074107, + 0.006583419, + -0.018933937, + -0.013131601, + -0.0046630106, + 0.029904343, + -0.020460866, + -0.026920957, + -0.009437604, + -0.0032975823, + -0.005552741, + 0.023174105, + 0.022856973, + -0.01908663, + -0.037891366, + -0.04446891, + 0.01624419, + 0.026756518, + 0.010864696, + 0.010060122, + 0.038267225, + 0.01463504, + -0.005147517, + 0.024102008, + -0.0046571377, + -0.023596946, + -0.04031096, + 0.005623215, + -0.0007454797, + 0.018076506, + 0.03800882, + 0.0069768974, + -0.032417905, + 0.019873586, + 0.008462718, + -0.02833043, + -0.020977674, + 0.021929068, + 0.0106943855, + -0.010946916, + 0.03232394, + -0.00038246668, + -0.0058170175, + -0.029223097, + 0.017031146, + 0.003156635, + 0.013871575, + 0.0034796393, + 0.056238018, + 0.013895066, + 0.01938027, + -0.0010071867, + 0.0076816343, + 0.038854506, + 0.0026970876, + -0.0089736525, + -0.0063308883, + -0.034179747, + 0.029551975, + 0.0124151185, + -0.006189941, + 0.032746784, + -0.028447887, + -0.0071237176, + 0.025534974, + 0.010295034, + 0.016502593, + 0.0015122483, + -0.021083385, + -0.020777998, + 0.015245812, + -0.0042695324, + -0.017818103, + -0.026122255, + 0.0013551507, + -0.011117227, + -0.008785723, + -0.017794611, + -0.003970019, + -0.023326797, + 0.03596508, + 0.01881648, + -0.018652042, + -0.021647174, + -0.009989648, + 0.0035090034, + -0.020120244, + 0.0064659626, + 0.010841206, + 0.020531341, + 0.012403373, + 0.012697013, + 0.006060739, + 0.0061312127, + -0.017418751, + 0.015445488, + -0.015234067, + 0.007928292, + 0.059996616, + -0.01662005, + -0.020860218, + -0.0059609013, + -0.009907429, + 0.032253467, + -0.031266835, + -0.019720893, + -0.012027513, + 0.01131103, + 0.010606294, + 0.0011503365, + 0.0019996916, + 0.0064953268, + 0.0023770195, + -0.02452485, + -0.015856585, + 0.0031830624, + -0.026498115, + 0.008621284, + 0.00873874, + -0.034438152, + -0.013425241, + -0.010770732, + -0.03455561, + 0.0038349442, + 0.0019130675, + -0.01774763, + 0.017994286, + -0.01766541, + -0.0036528872, + -0.018640297, + -0.014024268, + 0.011052627, + 0.023620438, + -0.0065658004, + 0.03436768, + -0.017677156, + 0.024031535, + 0.0057318616, + 0.042589612, + -0.0013845147, + 0.004601346, + -0.019756129, + -0.012767487, + 0.029387537, + -0.009566806, + -0.031619202, + 0.0058111446, + 0.029857362, + -0.03152524, + 0.024736272, + 0.015187085, + 0.003946528, + -0.019885331, + -0.032934714, + 0.03230045, + -0.057976373, + 0.027273325, + 0.0088092135, + 0.0033504376, + -0.011868947, + 0.003925973, + 0.013319531, + 0.013096364, + -0.05525139, + -0.0029143814, + 0.014623295, + -0.026756518, + 0.041156646, + -0.031948082, + -0.029340554, + 0.016361646, + -0.033498503, + 0.0113521395, + -0.007822582, + -0.007945911, + 0.013918557, + 0.017970797, + -0.05074107, + -0.0030303695, + 0.017806357, + -0.012685267, + -0.00015113308, + 0.033357557, + -0.016772743, + 0.035448276, + 0.014423619, + 0.008298279, + -0.00877985, + -0.0029877916, + 0.028776765, + -0.025487991, + 0.005802335, + -0.01385983, + 0.0049595875, + -0.00030850602, + 0.027249834, + 0.020073261, + -0.03363945, + 0.023021411, + 0.0035236855, + 0.004848004, + 0.024008043, + -0.0137306275, + -0.013319531, + 0.013178583, + -0.026850482, + -0.03342803, + 0.06253367, + 0.012708759, + 0.022257946, + -0.009919175, + -0.02385535, + -0.011299285, + 0.00863303, + 0.04108617, + 0.010747241, + -0.030350678, + 0.02320934, + -0.030256713, + -0.026380658, + 0.029857362, + -0.052291494, + 0.006800713, + -0.01262654, + 0.020038025, + 0.0055409954, + -0.0031037796, + -0.0046718195, + 0.02544101, + 0.017336532, + -0.0014124106, + 0.040193506, + -0.016655287, + 0.0017383515, + -0.0115987975, + 0.033615958, + 0.033545487, + 0.001444711, + -0.016232444, + 0.007476086, + -0.011117227, + -0.021893833, + 0.0013639599, + 0.0005604862, + -0.044140033, + 0.034297206, + 0.013307786, + -0.040945224, + -0.013942049, + 0.0675608, + -0.0014549885, + -0.023690911, + -0.0040463656, + 0.022046525, + 0.017125111, + 0.02621622, + 0.013636663, + -0.0060049472, + -0.00974299, + 0.0040170015, + -0.0038202624, + -0.008333516, + 0.0021817486, + 0.002009969, + 0.028048536, + -0.0037116155, + -0.014541076, + -0.017160349, + -0.0075876694, + -0.012344644, + 0.003934782, + 0.015786111, + 0.010265671, + 0.017794611, + -0.0012545788, + -0.023784876, + -0.012180206, + -0.044703823, + -0.018064762, + 0.006336761, + -0.0059051095, + 0.014834716, + 0.01929805, + -0.024430886, + -0.02659208, + -0.008903178, + -0.014682023, + -0.010600421, + -0.01814698, + -0.028964695, + -0.020296428, + 0.03356898, + -0.012368136, + 0.012967163, + 0.008257169, + 0.009977902, + -0.004290087, + 0.0007781472, + -0.018734261, + -0.03232394, + 0.0042196135, + -0.018076506, + -0.0036910605, + 0.026615571, + -0.019168848, + 0.026169237, + -0.022070017, + -0.0014417747, + -0.018182216, + -0.010835333, + 0.0006588558, + -0.04087475, + 0.015128356, + -0.007564178, + -0.015750874, + -0.01154007, + 0.03020973, + 0.022210963, + -0.033169627, + -0.035800643, + -0.018311419, + -0.011792601, + -0.00048744315, + -0.011545943, + -0.019697402, + 0.017430497, + -0.031948082, + 0.0047011836, + -0.023115376, + 0.046865016, + 0.012051004, + -0.027132379, + 0.007258792, + -0.009096981, + -0.0041961223, + -0.01358968, + 0.038337696, + 0.0055703595, + 0.011551815, + -0.0155277075, + -0.002061356, + -0.013096364, + -0.019063137, + 0.0064953268, + 0.00054543716, + -0.0041050934, + -0.007752108, + -0.011639908, + -0.03683426, + -0.022833481, + 0.004833322, + -0.014024268, + -0.010259798, + -0.0034972578, + -0.010623911, + -0.015163593, + -0.008086858, + -0.0027749024, + -0.032182995, + -0.0281425, + -0.037280593, + 0.0134017505, + 0.009378877, + 0.0058405087, + -0.016279427, + 0.0115987975, + -0.013566189, + 0.029387537, + -0.003150762, + 0.017794611, + -0.0028629943, + -0.036223486, + 0.0056525785, + -0.016737506, + -0.0064953268, + 0.021330042, + 0.03114938, + -0.021083385, + -0.021236077, + 0.026169237, + 0.015328032, + -0.06690304, + -0.014764242, + 0.014129979, + 0.024665799, + 0.0017868022, + -0.022586824, + -0.011692763, + -0.028847238, + 0.0038554992, + 0.00320949, + 0.007998766, + -0.03702219, + 0.06347332, + 8.6211e-05, + 0.032394417, + 0.007570051, + 0.020672288, + 0.013260803, + 0.040545873, + -0.029411027, + 0.0004745964, + 0.018381892, + 0.028025044, + -0.018734261, + 0.041555997, + -0.018558078, + -0.026639063, + -2.9960502e-05, + 0.017547954, + 0.022539841, + 0.032723293, + 0.014423619, + -0.035401292, + 0.024877219, + 0.05492251, + 0.0014674682, + 0.023385527, + -0.021517973, + 0.0019218768, + 0.03439117, + -0.012344644, + -0.06023153, + -0.030092273, + 0.002497412, + 0.03098494, + 0.0069357874, + -0.008644775, + 0.004157949, + 0.008380499, + 0.012556066, + -0.019932315, + -0.009919175, + 0.008562556, + -0.008644775, + 0.019016156, + 0.019027902, + -0.0020892518, + 0.048251, + -0.027085396, + -0.0049243504, + -0.018640297, + 0.034673065, + -0.00044266297, + -0.000776679, + 0.019603437, + 0.052385457, + 0.007282283, + 0.0024636434, + 0.0013558848, + -0.002149448, + -0.012591302, + 0.05567423, + 0.032629326, + 0.0458314, + -0.047146913, + -0.007387994, + -0.00061003806, + -0.0052649733, + 0.004125648, + -0.01758319, + -0.014588058, + -0.021635428, + 0.03462608, + -0.0037174881, + -0.010946916, + 0.012121478, + 0.020178972, + 0.017806357, + -0.016009277, + -0.0064953268, + -0.035824135, + 0.0057083704, + -0.035095908, + -0.009789973, + 0.02088371, + -0.048297983, + -0.005482267, + 0.007722744, + 0.02774315, + 0.007176573, + 0.0062897787, + 0.0120862415, + 0.018182216, + -0.04200233, + -0.00013342289, + 0.0023241641 + ], + "Category": "Boutique", + "Tags": [ + "continental breakfast", + "air conditioning", + "free wifi" + ] + }, + { + "@search.action": "mergeOrUpload", + "HotelId": "49", + "HotelName": "Swirling Currents Hotel", + "Description": "Spacious rooms, glamorous suites and residences, rooftop pool, walking access to shopping, dining, entertainment and the city center. Each room comes equipped with a microwave, a coffee maker and a minifridge. In-room entertainment includes complimentary W-Fi and flat-screen TVs.", + "DescriptionVector": [ + -0.042438243, + -0.016445654, + 0.031978894, + 0.014899005, + -0.034515843, + -0.018871332, + -0.0060530687, + 0.004514766, + 0.021452786, + -0.004854138, + -0.00635906, + 0.01942768, + 0.010164482, + -0.024857638, + -0.02872982, + 0.03224594, + -0.08630073, + 0.040235102, + 0.04464138, + 0.059195448, + -0.004511984, + 0.007293725, + -0.050516415, + -0.025814557, + -0.03353667, + 0.04793496, + -0.058171768, + 0.013619404, + 0.002342226, + 0.026081603, + -0.0065204008, + -0.02081855, + 0.055545803, + 0.0077165496, + 0.027906425, + -0.029642232, + 0.013552642, + -0.028173473, + 0.029976042, + 0.010615123, + 0.007377177, + 0.038388025, + -0.029152647, + 0.002190621, + 0.009535808, + -0.031244515, + -0.010186736, + 0.022331817, + 0.01183909, + 0.051139526, + -0.021920118, + 0.032824542, + -0.03467162, + -0.06738489, + -0.015433099, + 0.008617834, + -0.024011988, + -0.06168789, + 0.0066094166, + -0.012028248, + -0.016412271, + -0.004717833, + -0.00071351655, + 0.065782614, + -0.020150932, + -0.0036718983, + -0.013730674, + 0.05416606, + -0.016935239, + 0.007199146, + 0.01865992, + -0.008901571, + 0.00586391, + -0.019283028, + 0.014309276, + -0.004884737, + -0.02939744, + -0.012161772, + -0.015088163, + -0.017725253, + -0.033959493, + -0.026014842, + 0.013541515, + 0.064892456, + 0.018615412, + -0.0016440089, + -0.029019123, + -0.024857638, + -0.010370331, + 0.08242855, + 0.00936334, + 0.014008848, + -0.02939744, + -0.0045481464, + -0.060797732, + -0.013942086, + 0.050516415, + -0.009285452, + -0.034938667, + 0.102635115, + 0.054077044, + -0.07601942, + -0.01334123, + -0.007199146, + 0.041548084, + -0.04043539, + 0.044218555, + -0.016768334, + 0.054121554, + 0.008050359, + -0.100409724, + -0.01759173, + -0.039233677, + -0.022854785, + -0.01169444, + 0.006971043, + 0.026704714, + -0.0396565, + -0.021797722, + 0.011388448, + 0.026326397, + 0.03745336, + 0.0032212562, + -0.044730395, + 0.00016334036, + -0.069877334, + -0.015344083, + -0.015900431, + -0.03834352, + 0.02821798, + -0.032156926, + -0.006820829, + 0.003908346, + -0.0040696873, + 0.011271615, + 0.067028835, + 0.0042115557, + 0.0042477185, + -0.002353353, + -0.051451083, + 0.006670615, + 0.0075273914, + 0.021530675, + 0.015666766, + -0.00064223446, + -0.01865992, + 0.013096437, + 0.027505856, + -0.05812726, + 0.042838812, + -0.013051929, + 0.022109278, + 0.0043200436, + 0.0035578469, + -0.004717833, + -0.027327824, + -0.01198374, + 0.015666766, + -0.015533242, + 0.033803716, + 9.8925666e-05, + -0.026370905, + -0.04090272, + -0.016734954, + 0.0051184036, + 0.012974041, + -0.018637665, + 0.040079325, + -0.052474763, + -0.028574044, + 0.05109502, + -0.00897946, + -0.004648289, + 0.040546656, + 0.03823225, + 0.031177754, + 0.021964626, + 0.012751501, + 0.008028105, + -0.015855923, + 0.00059146766, + -0.025347224, + 0.050783463, + -0.018938093, + -0.013908705, + 0.019071616, + -0.056569487, + 0.013196579, + 0.0064425124, + 0.030287595, + -0.025747795, + 0.00039744124, + -0.032958068, + 0.0027094157, + -0.045932107, + 0.059507005, + -0.0645809, + -0.007026678, + 0.0031990022, + -0.008812556, + -0.037742663, + -0.03745336, + 0.04855807, + -0.01660143, + -0.02599259, + -0.04882512, + -0.024590591, + 0.041147515, + 0.024568336, + 0.0021113413, + 0.018715553, + -0.017970048, + 0.01824822, + 0.04533125, + -0.017257921, + -0.008634524, + -0.02169758, + -0.0016273186, + 0.0062978617, + 0.052830826, + 0.00030338363, + 0.024902146, + 0.005541228, + 0.025681034, + -0.034248795, + 0.031311277, + -0.0039361636, + -0.030220835, + 0.014943513, + -0.0041002864, + -0.008957206, + -0.018926965, + -0.03700828, + -0.022632245, + -0.039055645, + 0.01920514, + -0.029864771, + 0.015377465, + 0.0074161217, + 0.0016328819, + -0.029820263, + -0.016746081, + 0.008985024, + 0.038388025, + 0.04753439, + 0.0014798862, + 0.031756356, + -0.03516121, + 0.029820263, + -0.032713275, + -0.03484965, + -0.0040029255, + 0.014887878, + -0.01620086, + 0.02209815, + 0.013330103, + 0.04468589, + 0.013241087, + 0.02763938, + -0.03262426, + 0.07054495, + 0.023655925, + 0.0039806715, + -0.027327824, + 0.01418688, + 0.0022490376, + -0.07695408, + 0.019383172, + -0.004595436, + -0.034538098, + -0.065871626, + -0.026726969, + -0.0013651394, + 0.015766907, + 0.036229394, + 0.0050738957, + 0.01689073, + -0.032490734, + -0.019861631, + 0.033625685, + 0.00045307606, + -0.033403147, + -0.00094787823, + -0.015010275, + 0.018014556, + 0.023767196, + 0.036073618, + 0.015566623, + -0.051228542, + -0.0020807423, + 0.022120405, + -0.025903573, + 0.0077221133, + -0.06426934, + 0.0055467915, + 0.02741684, + 0.028017696, + -0.012662485, + 0.031467054, + 0.003716406, + 0.0029152646, + 0.028707568, + -0.0065815994, + -0.008634524, + -0.044218555, + 0.019872759, + -0.020640519, + 0.0061810287, + 0.01993952, + -0.03213467, + -0.010820973, + 0.004890301, + 0.026860492, + -0.071034536, + -0.016868478, + -0.012862771, + 0.0066094166, + 0.03573981, + -0.010876607, + -0.03625165, + 0.0018429034, + 0.010047649, + 0.0038332392, + -0.018737808, + -0.015533242, + -0.043595444, + 0.017002001, + 0.03206791, + -0.05416606, + -0.0645809, + 0.08033668, + -0.007087876, + 0.021864485, + -0.016668193, + -0.027461348, + -0.0005031474, + -0.046599727, + 0.001794223, + -0.009652642, + 0.0019694727, + -0.012072756, + -0.03954523, + -0.026526682, + 0.02158631, + 0.02906363, + -0.050827973, + -0.022921545, + 0.016334383, + 0.05461114, + 0.017947793, + -0.0060864496, + -0.015188306, + -0.020184312, + 0.02022882, + 0.007466193, + -0.0018442943, + 0.05376549, + 0.010609561, + -0.063690744, + -0.007922399, + -0.015644511, + 0.03602911, + 0.039122406, + 0.0029903715, + 0.038321264, + 0.03324737, + -0.07152413, + 0.048157502, + -0.034248795, + -0.013096437, + 0.028685313, + 0.03602911, + 0.010726393, + 0.008005851, + -0.0317341, + 0.03489416, + 0.026771476, + 0.03478289, + -0.0135081345, + -0.019750362, + 0.014164626, + 0.0030654785, + 0.0015758564, + -0.02345564, + 0.005869474, + 0.0041308855, + -0.018192586, + 0.0026009278, + -0.024368051, + 0.04039088, + -0.015121545, + -0.014609704, + -0.020774042, + 0.011916978, + 0.002382561, + 0.024590591, + 0.02254323, + 0.004690015, + -0.0038582748, + -0.0017205068, + -0.0028846655, + -0.08095979, + 0.021630818, + -0.028418267, + -0.011154781, + -0.08403084, + -0.0057415133, + -0.07459517, + 0.0026440448, + -0.007377177, + -0.026704714, + -0.07330444, + 0.0011891943, + 0.0043756785, + -0.042505004, + -0.024345798, + -0.003040443, + -0.012762628, + 0.045108713, + -0.011288305, + 0.047890455, + 0.028418267, + -0.020351218, + 0.024078751, + -0.029775755, + 0.014164626, + 0.027861917, + -0.054922696, + -0.08082627, + 0.0065037105, + -0.02532497, + -0.0054689026, + 0.018481888, + 0.053008858, + -0.017213413, + 0.012873897, + -0.019783743, + -0.020874185, + -0.018493015, + -0.032334957, + -0.0039973618, + -0.017246794, + -0.06831956, + 0.0023783885, + -0.0055885175, + -0.004776249, + 0.007466193, + 0.06769645, + 0.014554069, + -0.03941171, + 0.004606563, + -0.028106712, + -0.015510988, + -0.01663481, + -0.015533242, + -0.00910742, + 0.023188593, + -0.0034187597, + -0.023477895, + 0.009975323, + -0.0012643012, + 0.00872354, + -0.016334383, + -0.007226963, + 0.014832243, + -0.050516415, + -0.051228542, + 0.025191447, + 0.0084620565, + -0.0012656922, + -0.060263637, + -0.05225222, + 0.025725542, + 0.031222261, + 0.023010561, + -0.06716236, + 0.011916978, + 0.03375921, + 0.03008731, + 0.008818119, + 0.0034716127, + 0.013741801, + -0.05421057, + -0.0051712566, + -0.008801429, + -0.020317836, + -0.05171813, + -0.021608565, + -0.05087248, + 0.0007510701, + -0.023366624, + 0.016223114, + -0.0037831678, + -0.008139375, + 0.035495017, + 0.015922686, + -0.059685037, + 0.0050405147, + 0.015900431, + 0.00504886, + -0.023144085, + 0.0021447223, + -0.0072992886, + 0.012384311, + -0.0040724687, + 0.04508646, + -0.030643659, + -0.024546083, + 0.022131532, + 0.007939089, + 0.010904425, + 0.003952854, + -0.026905, + 0.02158631, + 0.021742089, + 0.0317341, + -0.0052574906, + -0.015166052, + -0.0018707209, + -0.0373866, + 0.0033881606, + -0.0075997165, + 0.019349791, + -0.0027163702, + 0.015332957, + 0.027950933, + 0.0017664055, + -0.053053364, + 0.014887878, + -0.0023060634, + -0.018481888, + -0.010954496, + -0.0036440808, + 0.008940516, + 0.020673899, + 0.016690446, + -0.008934952, + -0.015766907, + 0.06720687, + -0.022309562, + 0.062355507, + -0.0055996445, + 0.008406421, + -0.047667913, + -0.02045136, + -0.023833957, + -0.018737808, + 0.0004965408, + 0.0056441524, + 0.020918693, + 0.015922686, + 0.01891584, + 0.028685313, + 0.004831884, + -0.009864054, + 0.0054522124, + 0.015154925, + 0.0043784603, + 0.0063924408, + 0.01653467, + -0.019227395, + 0.033981748, + -0.0064369487, + 0.021908993, + 0.024056496, + 0.019527823, + 0.030398866, + 0.039745517, + 0.0016314911, + -0.0076776054, + -0.0018915839, + 0.004879174, + -0.008823683, + -0.011266051, + 0.023121832, + -0.015855923, + 0.008200573, + -0.011627678, + -0.021541802, + 0.0066038533, + 0.013608277, + -0.010943369, + 0.070856504, + 0.028351504, + -0.011672186, + -0.038388025, + 0.022198293, + 0.00599187, + 0.034827396, + 0.017836524, + 0.05047191, + 0.004709488, + 0.029953787, + -0.03756463, + 0.011154781, + -0.010075466, + -0.03874409, + 0.005824966, + -0.031088738, + 0.026482174, + -0.018203713, + 0.0025703288, + -0.030843945, + -0.008884881, + 0.0064202584, + -0.009023968, + -0.01235093, + -0.013296722, + -0.007338233, + -0.038098726, + -0.012484454, + -0.008779175, + -0.013330103, + -0.00038735743, + -0.03456035, + 0.04339516, + -0.033692446, + -0.034649365, + 0.010409275, + -0.0006161556, + -0.007215836, + 0.0144873075, + 0.018626537, + 0.038833104, + 0.020840803, + 0.039589737, + -0.013719547, + -0.044396587, + 0.0013018548, + -0.04159259, + 0.048157502, + 0.030510135, + 0.058260784, + 0.008050359, + 0.0032880178, + 0.058750372, + -0.014398292, + 0.017881032, + -0.0077833114, + -0.019772615, + 0.009908562, + -0.0038304573, + -0.0004770686, + 0.004587091, + 0.014453926, + 0.018637665, + 0.046866775, + -0.023811704, + 0.0013498398, + 0.016746081, + 0.0033492162, + -0.016901858, + 0.016846223, + -0.03705279, + 0.0024785313, + 0.026504429, + 0.029820263, + -0.0030265343, + 0.023767196, + 0.036563203, + -0.023411132, + 0.025814557, + -0.015889306, + -0.002148895, + 0.0007246435, + 0.012484454, + -0.016390018, + 0.02129701, + -0.021397153, + 0.03903339, + 0.06876464, + 0.0033325257, + 0.0020626609, + 0.018782316, + 0.035450507, + 0.010047649, + 0.04226021, + -0.02019544, + -0.0022490376, + 0.026037097, + 0.008183883, + 0.017291302, + -0.056124408, + 0.008834809, + 0.0015313484, + -0.04159259, + 0.034449082, + 0.0032435101, + 0.039055645, + -0.0052686175, + -0.0018081317, + -0.0018289947, + -0.0042699724, + 0.016245367, + 0.0026273543, + -0.041214276, + 0.00060607184, + 0.0037108425, + 0.0186933, + -0.03698603, + 0.013174325, + 0.024657352, + 0.048469055, + -0.010409275, + 0.0027247153, + -0.014298148, + 0.02815122, + -0.037653647, + 0.029508708, + -0.018748935, + -0.005930672, + -0.013908705, + 0.001450678, + -0.024746368, + 0.013797436, + 0.004965408, + -0.01931641, + -0.0076497877, + 0.0054967203, + -0.009157492, + 0.004445222, + 0.032980323, + -0.0018526395, + 0.02209815, + -0.016935239, + -0.0041948655, + -0.023722688, + -0.01469872, + -0.01850414, + 0.04350643, + 0.012885025, + 0.006715123, + -0.008473183, + -0.0013727891, + 0.019917266, + 0.0006780494, + -0.00078584184, + -0.014921259, + -0.021864485, + -0.011894724, + 0.0009228426, + -0.02396748, + -0.018737808, + -0.02345564, + 0.030154074, + -0.034916412, + 0.018871332, + -0.043773476, + -0.057637673, + 0.020473614, + -0.047000296, + 0.0059139812, + 0.022009134, + -0.031110993, + -0.028774329, + -0.024167767, + 0.033158354, + 0.0132744685, + -0.02059601, + -0.0031461492, + 0.02056263, + 0.0045592734, + 0.009096293, + 0.004996007, + 0.032312702, + -0.03516121, + 0.0063089887, + 0.013997721, + -0.01784765, + -0.0050961496, + -0.008005851, + 0.030198582, + 0.029998295, + -0.011210416, + -0.024501575, + 0.0053159073, + -0.014342656, + -0.053453937, + 0.026593445, + -0.0016064554, + 0.04317262, + -0.009886308, + 0.024523828, + -0.010292442, + 0.019739235, + 0.00011300823, + -0.0036496443, + -0.027350077, + 0.005824966, + -0.011738948, + -0.0042950083, + -0.004973753, + 0.005187947, + -0.02792868, + -0.010275751, + 0.029041376, + -0.00084773556, + 0.015099291, + 0.04457462, + 0.007076749, + -0.0031350222, + 0.011099147, + 0.04159259, + 0.012506708, + 0.027995441, + 0.00896277, + -0.0075496454, + 0.01920514, + 0.014453926, + -0.042638525, + -0.021029962, + 0.033380892, + 0.0020668337, + 0.003502212, + -0.007922399, + 0.0066261073, + 0.0048597017, + 0.0012197935, + 0.0029820264, + -0.009079603, + -0.0030460064, + -0.027973188, + 0.00013734847, + 0.03910015, + 0.0051962924, + 0.015332957, + -0.020484742, + -0.012373184, + 0.014821116, + -0.029731248, + 0.015277321, + 0.010164482, + -0.016946366, + 0.032958068, + 0.00080531405, + -0.009674896, + 0.013152071, + 0.04628817, + 0.004050215, + 0.007087876, + 0.005797148, + 0.014809989, + -0.011227107, + -0.00030338363, + -0.012250788, + -0.023188593, + -0.019160632, + 0.014287022, + 0.006325679, + 0.0013797436, + 0.048335534, + -0.0014882315, + 0.02679373, + -0.022365198, + 0.020940946, + 0.018370617, + 0.019984027, + 0.020150932, + 0.008617834, + 0.0065927263, + -0.0373866, + 0.0039695445, + -0.004756777, + 0.0002465318, + -0.03496092, + 0.03262426, + -0.0011224325, + 0.00044264455, + 0.012829389, + 0.032223687, + -0.0025911918, + -0.013686166, + -0.007916835, + 0.028084457, + 0.032980323, + -0.008812556, + 0.008806992, + 0.009391158, + 0.021174613, + -0.05643596, + 0.014921259, + 0.012517835, + -0.0013560988, + 0.016134098, + -0.018737808, + 0.021675326, + -0.021285882, + 0.010509417, + -0.003911128, + 0.0016301002, + -0.0031600578, + 0.013007421, + 0.027238809, + -0.019728107, + -0.02815122, + 0.019616839, + -0.011154781, + 0.0271943, + -0.01195036, + 0.014720974, + -0.028596297, + 0.0043005715, + -0.020863058, + -0.032713275, + -5.333119e-05, + 0.02554751, + -0.012061629, + -0.008222827, + 0.012662485, + 0.012484454, + 0.009702712, + -0.024011988, + -0.024768623, + 0.0015077037, + 0.0061587747, + 0.02781741, + -0.019984027, + -0.010770901, + 0.00317953, + -0.016022827, + 0.009246508, + 0.039011136, + -0.038944375, + -0.036919266, + -0.018826824, + 0.0012184025, + -0.031978894, + 0.012818263, + -0.0038332392, + -0.011961486, + 0.0030237525, + 0.006002997, + 0.029931534, + 0.018826824, + 0.046377186, + 0.0042254645, + 0.0135303885, + -0.014453926, + 0.009074039, + -0.0033186171, + -0.009352214, + 0.030621406, + -0.017613985, + -0.0022309562, + 0.021352645, + -0.019561203, + 0.022242801, + -0.0023658706, + -0.0040335245, + -0.03240172, + 0.028907852, + 0.030866198, + 0.015021401, + -0.010214553, + -0.021486167, + 0.008222827, + -0.014520688, + -0.0009694368, + 0.04372897, + -0.005713696, + -0.0049209, + 0.013441373, + 0.016935239, + -0.012951787, + 0.010342513, + 0.013953213, + -0.011438519, + 0.08006963, + -0.017391445, + 0.015700147, + -0.0073437965, + -0.001139123, + 0.03785393, + 0.008584453, + -0.045041952, + 0.032268196, + -0.0036162634, + 0.026148366, + 0.024457067, + 0.045531537, + -0.0017385881, + 0.021397153, + 0.025614271, + -0.03631841, + -0.011538662, + -0.008606707, + 0.018203713, + 0.0076609147, + 0.031222261, + -0.008795865, + -0.003351998, + -0.020295583, + -0.0037442234, + 0.029664487, + -0.045976616, + -0.0020974327, + -0.03160058, + 0.044263065, + -0.015933814, + -0.0020904783, + -0.012150645, + -0.009352214, + -0.0073326696, + -0.021675326, + 0.02345564, + 0.028329251, + 0.006164338, + 0.045754075, + -0.03522797, + -0.008690159, + 0.0399458, + 0.025814557, + 0.00190132, + -0.00080948666, + -0.0651595, + -0.032935813, + 0.027505856, + 0.018559776, + -0.0031183318, + 0.030398866, + 0.012317549, + 0.025124686, + 0.03331413, + -0.007293725, + 0.004500857, + -0.034627113, + 0.040346373, + 0.016512414, + 0.035094444, + 0.0053298157, + 0.023589164, + -0.0041475757, + 0.01436491, + -0.008222827, + 0.00074272486, + 0.016367765, + -0.035784315, + -0.021797722, + -0.011894724, + -0.001177372, + -0.005824966, + 0.023121832, + 0.003029316, + 0.013430246, + -0.046199154, + 0.015922686, + -0.0037831678, + 0.025169194, + 0.03522797, + -0.031467054, + 0.025235955, + -0.007421685, + -0.006002997, + -0.009852927, + -0.04611014, + 0.023922972, + -0.0189826, + -0.030732675, + 0.024212275, + -0.016134098, + 0.020417979, + 0.005836093, + 0.014965767, + -0.014976894, + -0.013864198, + -0.021397153, + -0.02605935, + -0.02939744, + -0.053409427, + 0.012562343, + 0.01469872, + 0.030554643, + 0.024612844, + -0.028796583, + 0.015600003, + -0.014832243, + -0.0026565627, + -0.0076497877, + 0.0052018557, + 0.066717274, + -0.012684739, + 0.02390072, + -0.019639092, + 0.008289589, + -0.00051044946, + 0.013140945, + 0.028574044, + -0.030732675, + 0.007883454, + 0.014676466, + -0.014142372, + 0.03030985, + -0.0034883032, + 0.0054383036, + -0.029130392, + 0.030287595, + 0.01627875, + -0.0036162634, + -0.004740087, + 0.02283253, + 0.025280463, + 0.025903573, + 0.0055384464, + -0.041614845, + -0.005638589, + 0.0043005715, + 0.02169758, + -0.011661058, + -0.03082169, + -0.024991162, + -0.015677892, + 0.004584309, + 0.009524682, + 0.0291749, + 0.014209134, + 0.024612844, + 0.016434526, + 0.02928617, + 0.021085598, + 0.0076720417, + -0.024078751, + -0.027327824, + 0.0094913, + 0.016211987, + -0.004564837, + 0.01198374, + -0.00938003, + 0.04159259, + 0.008779175, + 0.017402573, + 0.013441373, + -0.0030793874, + -0.025703287, + -0.04366221, + -0.03306934, + -0.0075663356, + 0.010164482, + 0.00069126266, + 0.010971187, + 0.01123267, + -0.00010631466, + 0.0035300294, + 0.010542799, + 0.004612127, + 0.0020751788, + -0.020651646, + 0.016423399, + 0.033514418, + 0.010893298, + 0.030487882, + -0.015622257, + 0.029775755, + 0.008567763, + 0.004948717, + 0.01484337, + 0.028195728, + 0.0052713994, + -0.017224541, + -0.025213702, + -0.005869474, + -0.06391328, + -0.015600003, + -0.01821484, + 0.010320259, + -0.0110602025, + 0.014965767, + -0.035517268, + 0.010047649, + -0.012428819, + 0.032846797, + 0.026037097, + -0.023099577, + -0.0019430461, + -0.010487163, + -0.010019831, + 0.00899615, + -0.0052853078, + 0.007232527, + 0.014609704, + -0.022020262, + -0.018548649, + 0.027038522, + -0.0027483602, + -0.01748046, + -0.023477895, + 0.014064482, + 0.024011988, + -0.019138379, + -0.013930959, + -0.041548084, + -0.01627875, + 0.02206477, + 0.010476037, + -0.044841666, + -0.021374898, + 0.0017038163, + -0.014053356, + 0.012417692, + 0.020584883, + -0.021085598, + 0.014921259, + 0.005747077, + -0.017881032, + -0.03456035, + -0.053097874, + -0.008300715, + -0.011054639, + -0.03162283, + 0.0005358329, + 0.00092006085, + 0.016078463, + -0.0054216133, + -0.018804569, + -0.022921545, + 0.010036522, + -0.054700155, + 0.0034410136, + -0.02837376, + 0.01679059, + -0.01733581, + -0.0043868055, + -0.011405138, + -0.004434095, + 0.0074606296, + 0.025413986, + -0.012250788, + -0.013675039, + 0.022276182, + 0.0022267837, + 0.014264768, + 0.011438519, + 0.011082456, + -0.022131532, + 0.019372044, + 0.030799437, + 0.014809989, + -0.01627875, + 0.006153211, + -0.026215127, + -0.018459633, + -0.013919832, + 0.022409705, + 0.017881032, + 0.00246045, + 0.030131819, + -0.004770686, + -0.021029962, + -0.0050989315, + -0.013775182, + 0.00013326279, + 0.044441096, + -0.007455066, + -0.013719547, + 0.016223114, + -0.0066761784, + 0.0021711488, + 0.021942373, + -0.013474753, + -0.028596297, + -0.013730674, + 0.005641371, + -0.0006811788, + -0.0019889448, + 0.033803716, + 0.0028067767, + 0.005897291, + -0.0076275337, + 0.025480747, + 0.03943396, + 0.031266768, + -0.04012383, + -0.031244515, + -0.014720974, + 0.0027316697, + 0.021908993, + -0.029820263, + -0.0040474334, + 0.022587737, + -0.0005236628, + -0.0032880178, + -0.009574752, + -0.041548084, + -0.027172046, + -0.0028387667, + 0.0009951679, + 0.024234528, + -0.008473183, + 0.032780036, + 0.017213413, + 0.022164913, + -0.026838237, + 0.035762064, + -0.025347224, + -0.047000296, + 0.0135303885, + 0.03727533, + 0.0038582748, + -0.07579688, + 0.004381242, + 0.025970334, + 0.0020334527, + 0.016801717, + 0.009391158, + 0.021196866, + -0.014465054, + 0.0149991475, + 0.016134098, + -0.009435666, + -0.01447618, + -0.011961486, + -0.015633384, + 0.0076831686, + -0.0026009278, + 0.0018136952, + 0.026994014, + -0.007143511, + -0.024011988, + -0.0037803862, + 0.015811415, + -0.044552363, + 0.029130392, + 0.018637665, + -0.007176892, + -0.0029263915, + 0.022899292, + 0.010381457, + -0.005980743, + -0.034360066, + 0.022120405, + -0.008528818, + 0.01495464, + 0.033692446, + 0.0067318133, + -0.033047084, + -0.002834594, + -0.0016899076, + 0.0041336673, + 0.019739235, + 0.006831956, + 0.00014725841, + 0.015332957, + -0.03378146, + -0.03326962, + -0.012106137, + 0.045398016, + 0.010342513, + -0.0045592734, + -0.061999444, + -0.011388448, + -0.019616839, + 0.013118691, + -0.039901294, + 0.0031350222, + 0.02872982, + 0.038543805, + 0.03211242, + 0.0029403004, + 0.009424538, + 0.0043228255, + -0.0052992166, + -0.020440234, + 0.014988021, + 0.012929533, + -0.024256783, + 0.0019152287, + 0.012072756, + -0.010359203, + -0.014131244, + 0.0069543524, + -0.015032529, + 0.01436491, + -0.0069877333, + -0.02272126, + -0.024390304, + 0.0040585604, + -0.007377177, + 0.013574896, + 0.014932386, + 0.02844052, + 0.010693013, + -0.035895586, + -0.008256207, + 0.0416371, + 0.0020056353, + 0.013430246, + -0.026704714, + 0.02939744, + -0.06631671, + -0.036095873, + 0.002984808, + -0.03716406, + -0.02019544, + -0.01594494, + 0.036229394, + 0.032891307, + -0.0026885527, + 0.019627964, + -0.026415413, + 0.0009965587, + 0.030131819, + -0.014554069, + -0.0012851644, + -0.0044424403, + -0.0020028534, + -0.012962913, + -0.015711274, + 0.010492727, + -0.032090165, + 0.008373041, + 0.0027024613, + 0.052430253, + -0.00822839, + 0.013441373, + -0.006659488, + 0.027728396, + 0.0075107007, + -0.013630531, + 0.013396865, + -0.0050099157, + 0.0094913, + 0.0040724687, + -0.002278246, + 0.0043562064, + -0.028907852, + -0.01858203, + 0.028351504, + -0.01198374, + -0.021185739, + -0.0026106639, + 0.013063055, + -0.04944823, + 0.008912698, + 0.01108802, + 0.051362067, + 0.033336386, + 0.0064925835, + -0.01931641, + 0.0051712566, + 0.029775755, + -0.018871332, + 0.013074183, + -0.0043422976, + 0.026838237, + -0.01597832, + -0.0023018906, + 0.017324682, + -0.008284025, + -0.0021516767, + 0.003727533, + -0.01637889, + 0.03863282, + 0.001164854, + 0.031756356, + -0.0073215426, + 0.017714126, + 0.021753214, + 0.008367477, + 0.038766343, + -0.0006571863, + -0.028306996, + 0.031511564, + -0.012651358, + -0.0052380185, + 0.025970334, + 0.039567485, + 0.00258841, + 0.043973763, + 0.0063089887, + 0.011460773, + 0.030465627, + 0.00896277, + -0.044485603, + 0.015778035, + -0.006314552, + -0.0013060274, + -0.010642941, + 0.038165487, + 0.00021123845, + 0.032713275, + -0.009519118, + -0.037141807, + -0.039055645, + -0.008729103, + 0.009274324, + 0.019839376, + 0.0057192594, + -0.009213126, + 0.052830826, + 0.008478747, + 0.019182887, + -0.035205714, + -0.003491085, + 0.032935813, + 0.00061824196, + -0.017569477, + 0.0135081345, + 0.0053325975, + 0.001492404, + 0.0154887345, + 0.031289022, + 0.01594494, + 0.030220835, + 0.0050349515, + -0.011182599, + -0.031266768, + 0.01993952, + -0.012417692, + 0.0543886, + -0.039011136, + 0.0015132672, + 0.0029820264, + 0.01719116, + 0.018292729, + -0.0013463626, + -0.026370905, + 0.0325575, + -0.022632245, + 0.002912483, + -0.0232331, + 0.008406421, + -0.046822265, + -0.0018289947, + -0.040413134, + -0.018938093, + 0.01663481, + 0.02254323, + 0.007338233, + 0.011049075, + -0.028841091, + 0.021274755, + 0.023922972, + 0.009797292, + -0.030688167, + -0.017358065, + 0.0022434741, + -0.012684739 + ], + "Category": "Suite", + "Tags": [ + "air conditioning", + "laundry service", + "24-hour front desk service" + ] + }, + { + "@search.action": "mergeOrUpload", + "HotelId": "13", + "HotelName": "Luxury Lion Resort", + "Description": "Unmatched Luxury. Visit our downtown hotel to indulge in luxury accommodations. Moments from the stadium and transportation hubs, we feature the best in convenience and comfort.", + "DescriptionVector": [ + -0.0043867915, + -0.055055395, + 0.038483072, + 0.0319377, + -0.03757786, + -0.023976486, + -0.0436126, + 0.01048536, + 0.01361298, + -0.0047900747, + -0.009980531, + 0.0060753585, + -0.01002115, + -0.037740335, + 0.03226265, + 0.027086698, + -0.01874251, + 0.007897385, + 0.024858486, + 0.017071351, + 0.034235545, + -0.008680741, + 0.0021788892, + -0.0310557, + -0.008315175, + 0.030359384, + -0.028084751, + 0.00700378, + 0.020181563, + 0.018870167, + 0.0082977675, + -0.017257035, + 0.026483223, + -0.023593511, + 0.013438901, + 0.03834381, + 0.055055395, + 0.03713686, + 0.005698187, + -0.021910748, + -0.023233749, + 0.0804013, + -0.006237832, + 0.0064583323, + -0.004160489, + 0.0065975953, + -0.018359536, + 0.032123383, + 0.005999924, + 0.04312518, + -0.016491087, + -0.02583333, + -0.018475588, + -0.05788708, + -0.0023152512, + -0.0073751486, + 0.020494904, + -0.033075016, + 0.059511818, + -0.03453728, + -0.054034133, + -0.010160413, + -0.013705823, + 0.08959267, + -0.007050201, + 0.012475664, + -0.0026111854, + 0.031775225, + -0.02420859, + -0.025601223, + 0.041152284, + 0.009411873, + -0.0337017, + 0.0026155375, + 0.03411949, + 0.0010060318, + -0.01768643, + 0.022688301, + -0.0069283457, + -0.012150717, + -0.008622715, + -0.018614851, + -0.043728653, + 0.04695492, + -0.038483072, + -0.019357588, + -0.025972592, + -0.0003410861, + 0.0018539417, + 0.07227761, + 0.01878893, + 0.030823594, + 0.0070676086, + -0.025392327, + -0.016514298, + 0.047767285, + 0.02629754, + -0.04389113, + -2.9058505e-05, + 0.06847109, + 0.055426765, + -0.08207246, + 0.010920558, + 0.006208819, + -0.009655584, + -0.075434245, + 0.010642031, + -0.010113992, + 0.022699906, + 0.020030694, + -0.06693919, + 0.010392519, + -0.01403077, + 0.0088025965, + 0.013972743, + 0.013636191, + -0.00680649, + -0.04533018, + -0.022073222, + -0.03532644, + 0.020111931, + 0.010642031, + -0.010729071, + -0.042359233, + -0.02803833, + -0.058165606, + -0.009707808, + 6.0247665e-05, + -0.05059897, + -0.018556826, + -0.057283606, + -0.014170033, + -0.019984273, + -0.0054660817, + -0.025299486, + 0.027458066, + -0.027759803, + -0.017396297, + 0.008622715, + -0.0019743463, + -0.0306147, + -0.059372555, + 0.030800384, + -0.024719223, + -0.04238244, + -0.0020584846, + 0.02413896, + 0.032239437, + 0.002358771, + 0.03456049, + -0.027504487, + 0.010084978, + -0.0017901127, + -0.030916436, + -0.007160451, + -0.029686278, + -0.023001643, + -0.0038790612, + -0.021516168, + 0.024324644, + 0.0012243559, + 0.00021161482, + -0.00874457, + -0.019995878, + 0.058212027, + -0.004482535, + -0.032193016, + 0.011100439, + -0.071488455, + -0.0200423, + 0.036672648, + 0.0018771522, + -0.005497996, + 0.047117393, + 0.03794923, + 0.021249248, + -0.040386334, + 0.019972667, + 0.025090592, + 0.0054138578, + 0.017082956, + -0.05524108, + 0.079472885, + -0.013833481, + 0.006139187, + 0.04748876, + -0.035999544, + 0.02717954, + 0.013230006, + 0.056169502, + -0.010891545, + 0.005825845, + -0.038924072, + 0.027690172, + -0.01922993, + 0.012487269, + -0.027690172, + 0.036951177, + 0.004189502, + 6.527964e-05, + -0.01173873, + 0.018231878, + 0.0381117, + -0.02717954, + -0.014773508, + -0.019287957, + -0.029570226, + 0.019937852, + -0.024835275, + 0.007305517, + 0.011918611, + 0.011611071, + 0.024928117, + 0.02585654, + 0.023976486, + -0.043334074, + -0.036626227, + -0.026065433, + 0.042869862, + 0.03497828, + -0.016839245, + 0.0121159, + -0.0091971755, + 0.056215923, + -0.003539607, + 0.05222371, + -0.040316705, + -0.01043894, + -0.0018539417, + -0.010607216, + -0.022978432, + -0.037809964, + -0.033399966, + -0.03407307, + -0.023535484, + 0.043821495, + 0.015168087, + -0.027806224, + 0.03753144, + 0.022282116, + -0.013206796, + -0.003475778, + 0.003969002, + 0.03107891, + 0.02413896, + -0.03456049, + -0.00079568627, + 0.017280245, + 0.0535235, + 0.047952972, + -0.02244459, + 0.034258753, + -0.012812217, + -0.017373087, + 0.031287804, + 0.0101546105, + -0.018730905, + 0.027295593, + 0.03748502, + -0.029593436, + 0.0332607, + 0.03632449, + -0.017779272, + -0.01444856, + 0.00089795765, + -0.0058374503, + -0.002830235, + -0.0323787, + 0.0035134952, + 0.0003051823, + -0.07594488, + -0.032680437, + -0.053430658, + 0.03242512, + -0.040711284, + -0.060579505, + -0.039945334, + 0.03154312, + 0.043960758, + 0.012208743, + -0.040618442, + -0.047303077, + 0.043914337, + -0.022827564, + -0.027783014, + -0.020564536, + 0.046699602, + 0.021899143, + -0.058026344, + -0.025694065, + -0.015086849, + -0.033933807, + -0.018405957, + -0.024858486, + 0.0013774004, + -0.012858638, + -0.0019685437, + -0.045074865, + 0.030127278, + -0.009968926, + 0.04282344, + 0.06749625, + -0.02541554, + -0.02543875, + 0.013740638, + 0.02801512, + 0.033840965, + 0.012127506, + 0.045933653, + 0.0049438444, + -0.0034438635, + 0.02592617, + -0.0038906664, + -0.0043461733, + -0.0077175037, + 0.0058490555, + -0.010688453, + -0.003522199, + -0.025299486, + -0.017129377, + 0.055798132, + 0.02134209, + -0.028316855, + -0.009290018, + 0.029663067, + -0.018904982, + -0.0422896, + -0.020808248, + -0.022932012, + -0.030173698, + 0.018951405, + -0.009696202, + 0.02266509, + 0.020413669, + -0.03284291, + -0.015655508, + -0.027388435, + -0.011048216, + 0.013984349, + 0.026042223, + -0.024556749, + -0.028734645, + -0.008448636, + -0.02163222, + 0.0030811988, + -0.04790655, + 0.009231991, + 0.032564383, + 0.018011378, + 0.037763543, + -0.03279649, + -0.014309296, + 0.0352336, + 0.04748876, + -0.009997939, + -0.01381027, + 0.056215923, + 0.033492807, + -0.019125484, + -0.017767666, + -0.01361298, + 0.0032581792, + -0.023976486, + -0.0117851505, + 0.055937394, + 0.012220348, + -0.023222143, + -0.0006615003, + -0.009887689, + -0.009707808, + 0.008088873, + 0.0038268375, + 0.04827792, + 0.060347397, + -0.023314985, + 0.04345013, + 0.026947435, + 0.040502388, + -0.028827488, + -0.044192865, + 0.02462638, + 0.0037368967, + 0.018429168, + -0.026993856, + 0.0662893, + 0.01925314, + -0.012220348, + -0.026576066, + -0.0091971755, + 0.011239703, + -0.015121666, + -0.023790801, + 0.019717352, + -0.044703495, + -0.042405654, + 0.020402063, + 0.052966446, + 0.013311244, + 0.009539531, + -0.027574118, + 0.023071274, + -0.04403039, + -0.0009124643, + -0.036069177, + -0.009226189, + -0.029918384, + 0.011466006, + -0.052084446, + -0.020030694, + 0.034189124, + -0.007235885, + -0.0046856273, + -0.0049525485, + -0.025578013, + -0.00026891584, + 0.026831381, + 0.008761978, + -0.035512123, + 0.034189124, + 0.035651386, + 0.024278222, + 0.050970342, + 0.014634244, + 0.046978127, + -0.025531592, + 0.02369796, + 0.058490556, + -0.045910444, + -0.03460691, + 0.008773583, + -0.050227605, + -0.0207038, + 0.036022756, + 0.032216225, + -0.056308765, + 0.07009582, + -0.033748124, + 0.0053094104, + -0.010206834, + -0.012533691, + -0.04574797, + -0.040618442, + -0.032982174, + 0.010473755, + -0.024069328, + 0.03198412, + 0.0094234785, + 0.02889712, + 0.02286238, + -0.00025712923, + -0.0068238983, + -0.019392405, + -0.0007920596, + -0.026529646, + -0.016258981, + 0.049949076, + 0.05658729, + -0.021376906, + 0.029639857, + -0.017814089, + 0.014413744, + -0.027899066, + 0.050088342, + 0.0072997143, + 0.00453766, + -0.011146861, + 0.0002939397, + 0.013183585, + 0.030684331, + -0.030730752, + 0.0074505825, + -0.0134737175, + 0.05867624, + 0.05227013, + 0.0076768855, + -0.033957016, + -0.0104911635, + 0.016572325, + 0.0017233824, + -0.024742434, + -0.032169804, + -0.009667189, + -0.035117544, + -0.017303456, + -0.04827792, + -0.015365376, + -0.011396374, + -0.015168087, + -0.08272236, + -0.025531592, + -0.01024165, + -0.0025865242, + -0.047767285, + -0.010015347, + -0.01154144, + 0.001669708, + -0.013496928, + 0.008988281, + 0.0070676086, + -0.0038732586, + -0.022804353, + -0.059465397, + 0.032935753, + 0.017013324, + 0.027991908, + 0.03488544, + -0.01768643, + -0.038042072, + 0.045074865, + 0.010752281, + -0.0082977675, + 0.018638061, + -0.019171905, + 0.03504791, + 0.007264898, + 0.03834381, + -6.364765e-05, + 0.003577324, + 0.0050802063, + -0.010839321, + 0.0134156905, + -0.004444818, + 0.0030115673, + 0.006910938, + 0.017988168, + 0.030034436, + -0.0049815616, + -0.034769386, + 0.0053297197, + 0.017303456, + -0.0026372974, + -0.014320902, + -0.027968697, + 0.017396297, + 0.0102648605, + 0.02629754, + 0.015121666, + 0.0038268375, + 0.05380203, + -0.019148694, + 0.042498495, + -0.0018220273, + -0.0075318194, + 0.006110174, + 0.0104911635, + -0.04043276, + -0.030707542, + 0.00019529491, + 0.01883535, + 0.033051807, + -0.009812254, + 0.018754115, + 0.011466006, + -0.0055734306, + -0.01358977, + 0.00711403, + 0.010711663, + 0.01037511, + 0.02046009, + 0.012545296, + -0.0032088568, + -0.0033626268, + -0.013543349, + 0.0075782407, + 0.026854591, + 0.043032337, + 0.02806154, + 0.045423023, + 0.00076014514, + -0.015817981, + -0.002656156, + 0.042475283, + -0.0026909718, + 0.0003448941, + -0.017419508, + 0.005431266, + 0.026901014, + -0.01856843, + -0.019891432, + 0.0242318, + 0.021284062, + -0.022386564, + 0.03713686, + 0.026436802, + -0.034258753, + -0.0077407146, + 0.01883535, + -0.0025401032, + 0.011756137, + 0.04786013, + 0.00962657, + 0.014622639, + 0.011686506, + -0.008036649, + 0.0061507924, + -4.490242e-05, + -0.05268792, + -0.013183585, + -0.01444856, + 0.0111642685, + 0.024835275, + -0.02590296, + 0.014529796, + -0.020866273, + -0.016317008, + 0.008355794, + 0.0022166064, + 0.005724299, + 0.011378966, + -0.0034670741, + 0.026227908, + -0.0118954005, + 0.019090667, + 0.0022427181, + -0.030405805, + 0.039388284, + -0.037345756, + -0.011831571, + 0.019612905, + -0.011645887, + 0.034676544, + 0.029593436, + 0.08601825, + 0.019937852, + 0.004700134, + 0.010798703, + 0.013125559, + -0.04841718, + 0.0015391487, + -0.01856843, + 0.00036121398, + 0.04349655, + 0.039945334, + -0.007792938, + -0.005706891, + 0.043798286, + -8.5407526e-05, + 0.0077407146, + -0.030870015, + -0.01599206, + -0.031566333, + 0.0113905715, + 0.040896967, + 0.014390534, + 0.02592617, + 0.026111854, + 0.054173395, + -0.0034409622, + -0.0066440166, + 0.00024987594, + -0.022398168, + -0.003794923, + 0.016758008, + 0.023883643, + 0.00131067, + 0.015005613, + 0.000107167405, + 0.0027011263, + 0.03363207, + 0.063271925, + 0.018243482, + 0.049113497, + -0.025044171, + -0.0056952857, + -0.013671007, + 0.045005232, + 0.016224166, + 0.024278222, + -0.019218326, + 0.017535562, + 0.07264898, + 0.015342166, + 0.014970797, + -0.000658599, + 0.04658355, + 0.0008246994, + -0.00026238788, + -0.004270739, + 0.0011946174, + -0.047952972, + 0.00700378, + -0.00605795, + -0.06090445, + 0.01900943, + 0.01903264, + -0.012638138, + 0.03270365, + 0.044239286, + 0.017941745, + -0.021620616, + -0.00068144687, + -0.010113992, + 0.02281596, + 0.0034902846, + 0.0015420502, + -0.016096508, + 0.0078451615, + 0.036045965, + 0.005434167, + -0.031357437, + 0.014576218, + 0.0076884907, + 0.0059418976, + -0.036463756, + -0.0036469558, + -0.015817981, + 0.025369117, + -0.04054881, + 0.008408017, + 0.012545296, + 0.017013324, + -0.016932087, + -0.0071372404, + -0.01856843, + 0.022630274, + 0.011721321, + -0.011349953, + 0.024719223, + -0.0041372785, + -0.04024707, + -0.003916778, + -0.009609163, + 0.00350189, + 0.027017066, + -0.0006611377, + -0.0033539226, + 0.016583929, + 0.004308456, + -0.007949609, + 0.047419127, + 0.022769537, + 0.005268792, + -0.034281965, + 0.021620616, + 0.022374958, + -0.013044322, + 0.018382747, + 0.024835275, + -0.044657074, + 0.0013839283, + 0.0040821536, + 0.011146861, + -0.013554954, + -0.029430961, + 0.036719073, + -0.024788855, + 0.0088084, + -0.012754191, + -0.060486663, + 0.014529796, + -0.050274026, + 0.0076652803, + 0.00010517275, + -0.05166666, + -0.0011554495, + -0.07975141, + 0.03277328, + 0.027666962, + 0.020866273, + 0.051109605, + -0.031728804, + 0.009127544, + -0.002255774, + 0.03407307, + 0.015075244, + -0.029036382, + 0.02354709, + 0.017106166, + -0.0440536, + -0.020808248, + 0.00808307, + -0.010676848, + 0.015400192, + -0.020320825, + 0.03247154, + -0.019485246, + 0.0026155375, + -0.040664863, + -0.016978508, + -0.030916436, + 0.024579959, + 0.009597558, + 0.024835275, + -0.02847933, + -0.020309221, + -0.021725064, + 0.01920672, + -0.008007635, + 0.032634016, + 0.013554954, + 0.0050918115, + -0.0007768277, + 0.023373011, + -0.007125635, + -0.003063791, + 0.030196909, + 0.009522123, + -0.013659402, + -0.0019815997, + 0.027899066, + 0.041918233, + 0.00464791, + 0.027434856, + 0.00030608897, + -0.012672953, + -0.0050657, + -0.020169957, + -0.019833405, + -0.022920405, + -0.024974538, + 0.03409628, + 0.055287503, + 0.001724833, + -0.021156406, + 0.00055523956, + 0.0013157474, + -0.02006551, + 0.011141058, + -0.058026344, + -0.025020959, + -0.0088084, + -0.03189128, + -0.028966751, + 0.020135142, + 0.0034902846, + 0.0016987212, + -0.032123383, + 0.00832678, + -0.007856767, + -0.074459404, + -0.027458066, + 0.016792824, + 0.010026952, + 0.02850254, + 0.010009544, + -0.0066324114, + 0.016641956, + 0.026042223, + 0.003667265, + 0.0120114535, + 0.014053981, + -0.008077268, + -0.061600767, + 0.017744455, + -0.01903264, + -0.011988243, + 0.01793014, + -0.007908991, + -0.02046009, + -0.0076130563, + 0.0242318, + 0.036719073, + 0.016978508, + -0.062343504, + 0.023373011, + -0.023976486, + 0.0051150224, + -0.0032784885, + -0.020541325, + -0.02182951, + -0.025786908, + 0.021237642, + 0.010560795, + -0.04006139, + -0.031171752, + 0.029918384, + -6.260499e-05, + 0.0176168, + 0.018173851, + -0.008750373, + -0.033840965, + 0.0054196604, + -0.004444818, + -0.010723269, + -0.014390534, + -0.01574835, + 0.031752016, + 0.032076962, + 0.008512464, + -0.020843063, + 0.027040277, + 0.0012388624, + -0.013032717, + 0.018533614, + -0.020796642, + -0.0061682006, + -0.018904982, + 0.043403707, + 0.00044136288, + -0.041221917, + 0.03230907, + 0.016966904, + 0.008953465, + -0.035465702, + -0.025949381, + 0.008280359, + -0.009725215, + 0.02977912, + -0.027458066, + 0.038924072, + 0.0012889102, + -0.012255164, + -0.029570226, + 0.004984463, + -0.012800612, + 0.020007484, + -0.0014267227, + -0.00096396264, + 0.0142048495, + -0.0068355035, + 0.011210689, + 0.0077058985, + -0.0049786605, + -0.01810422, + -0.0204833, + 0.05356992, + -0.040363126, + -0.014959192, + -0.0047494564, + 0.019125484, + -0.016375035, + -0.004853904, + -0.0400846, + 0.02416217, + 0.016375035, + 0.007653675, + -0.043775074, + 0.014901165, + 0.014808323, + -0.011593664, + -0.030452225, + 0.0052455817, + -0.03319107, + -0.0042852457, + 0.035628177, + 0.040409546, + 0.042591337, + 0.011257111, + -0.011448598, + 0.0063248714, + -0.017303456, + 0.036417335, + 0.013763849, + 0.013264823, + 0.0141468225, + -0.014181638, + -0.0018423364, + 0.017349876, + -0.010845124, + 0.0072474903, + -0.0002625692, + 0.004920634, + -0.018139035, + -0.011251308, + -0.03451407, + -0.017872114, + 0.004351976, + -0.01764001, + -0.016467877, + -0.0118954005, + 0.030475436, + 0.042637758, + 0.018556826, + -0.04187181, + 0.012197138, + 0.018173851, + -0.0120114535, + 0.046026498, + -0.040316705, + -0.019682536, + -0.046746023, + 0.04087376, + 0.030336173, + -0.018638061, + -0.02303646, + 0.045098074, + 0.021214431, + -0.026622487, + 0.03279649, + 0.007508609, + 0.021109983, + 0.047117393, + 0.028641803, + -0.018580036, + 0.023906853, + -0.00872136, + 0.029245278, + 0.04618897, + 0.06638214, + -0.013090744, + 0.029755909, + -0.015922429, + 0.0014201947, + -0.0047784694, + -0.011750335, + -0.010560795, + 0.0057562133, + 0.039922126, + 0.012858638, + 0.0014883757, + -0.015260928, + -0.0038674558, + -0.020274404, + -0.01601527, + -0.011802559, + -0.0072939117, + 0.01317198, + 0.054684028, + 0.016908877, + -0.02182951, + 0.0015899219, + 0.029059593, + -0.014367322, + 0.033980228, + -0.005178851, + 0.0065975953, + 0.01491277, + -0.012498874, + 0.00028650506, + 0.0588155, + 0.019102274, + 0.018359536, + 0.011976638, + 0.020274404, + 0.002859248, + -0.0213653, + 0.024510328, + 0.030962858, + 0.017872114, + -0.0017698035, + 0.021260852, + 0.0003619393, + 0.021109983, + 0.028781068, + -0.003327811, + 0.00453766, + -0.0030724949, + -0.014460165, + -0.015284139, + 0.026483223, + 0.012371217, + 0.011907006, + 0.0108857425, + 0.025113802, + -0.010073373, + 0.004337469, + 0.00014488453, + 0.018498799, + 0.04015423, + 0.0007010308, + 0.027713383, + -0.0063074636, + 0.004380989, + 0.009638175, + -0.011129453, + 0.006446727, + -0.011007598, + -0.020982327, + 0.039341863, + -0.0207038, + -0.004674022, + 0.0006799962, + -0.01570193, + -0.035604965, + -0.013508533, + 7.747424e-05, + -0.04010781, + -0.031566333, + -0.023233749, + 0.0050918115, + 0.019810194, + 0.04837076, + 0.020529721, + -0.012231953, + -0.012800612, + 0.008065662, + 0.0005131705, + -0.009284215, + 0.016688377, + 0.024696013, + -0.0061856085, + 0.015817981, + -0.022108037, + 0.014158428, + -0.037392177, + 0.013322849, + 0.019125484, + 0.019856615, + 0.0057301014, + -0.010102387, + 0.033817753, + 0.01788372, + -0.02264188, + -0.0071662534, + 0.009725215, + -0.018614851, + 0.016084902, + 0.031357437, + 0.0137522435, + 0.014773508, + 0.015318955, + 0.03363207, + 0.02286238, + -0.0032175607, + 0.0141468225, + 0.0047320486, + -0.009336439, + -0.007763925, + -0.008814202, + -0.0068471087, + 0.032517962, + 0.01143119, + 0.006382898, + 0.04043276, + 0.026692118, + 0.018429168, + 0.0124060325, + 0.022189274, + -0.04187181, + -0.017407903, + 0.030312963, + -0.0381117, + 0.012893454, + -0.0068935296, + -0.004946746, + 0.004517351, + -0.007850965, + 0.0209243, + -0.012464059, + 0.033608858, + 0.011640085, + -0.02119122, + -0.031798437, + -0.009643978, + -0.025810119, + -0.04574797, + 0.01744272, + 0.042962704, + -0.008547281, + -0.0058490555, + 0.0079031885, + -0.021284062, + 0.011083032, + -0.017999772, + 0.03890086, + -0.02462638, + 0.020030694, + 0.05779424, + 0.017106166, + 0.003577324, + 0.016932087, + 0.0008566139, + -0.013195191, + -0.00016664442, + -0.010763887, + 0.019171905, + 0.018440772, + -0.0009987785, + -0.006910938, + -0.028200803, + -0.0061043715, + -0.0043693837, + -0.04136118, + 0.0033713307, + -0.009278413, + 0.00852407, + -0.011251308, + 0.036974385, + 0.030939646, + 0.0021817905, + 0.010990189, + -0.01748914, + 0.0007586944, + -0.007508609, + 0.034792595, + 0.02418538, + 0.021667037, + 0.017419508, + -0.0022398168, + -0.011117848, + -0.040943388, + 0.003339416, + 0.0009102883, + -0.014808323, + 0.006429319, + 0.010201031, + -0.0018452378, + 0.015876008, + 0.0034960872, + -0.0064815427, + -0.019160299, + 0.028200803, + 0.025044171, + -0.03790281, + -0.0310557, + 0.013624585, + 0.0070269904, + 0.026483223, + 0.001724833, + -0.017999772, + 0.0006977668, + -0.018278299, + -0.01643306, + 0.03291254, + -0.0153305605, + -0.0014419546, + -0.045074865, + -0.011222295, + -0.025299486, + 0.0007184387, + -0.016026877, + 0.008274557, + -0.001423096, + -0.05686582, + 0.05524108, + -0.053337816, + 0.02156259, + 0.014761902, + -0.013891507, + -0.019496853, + -0.03103249, + -0.025020959, + 0.015539455, + 0.01616614, + 0.044216074, + -0.013833481, + 0.02332659, + 0.005315213, + 0.017964955, + 0.0113905715, + 0.00581424, + -0.04607292, + -0.012556901, + 0.012452453, + 0.023222143, + 0.00021832412, + -0.005515404, + -0.009539531, + -0.018231878, + -0.0043432717, + -0.012104295, + -0.011907006, + 0.022386564, + 0.008141096, + -0.015678719, + 0.0014064135, + -0.031868067, + 0.0022934913, + -0.019392405, + -0.032564383, + 0.042869862, + -0.022792747, + 0.00095235737, + -0.0022209582, + -0.022525826, + -0.030243332, + -0.011930216, + -0.020030694, + -0.021574195, + 0.028386489, + -0.020668983, + 0.00061616726, + -0.0046014893, + -0.017698035, + 0.020854669, + -0.032216225, + 0.0148779545, + 0.025624434, + 0.026529646, + 0.0051730485, + -0.0065685823, + 0.015249323, + -0.020993931, + -0.015736744, + 0.042080704, + -0.019438826, + 0.026460012, + 0.0075666355, + 0.014494981, + -0.039550755, + 0.0021020044, + -0.03140386, + 0.006179806, + -0.03063791, + -0.0025589617, + 0.038088493, + 0.004645009, + -0.010694255, + 0.0043983967, + -0.0061043715, + 0.0032639818, + 0.06322551, + 0.0035251004, + -0.02347746, + -0.014460165, + 0.03797244, + -0.013404085, + -0.018046193, + 0.011442795, + -0.001568162, + -0.024579959, + 0.023663143, + -0.023535484, + 0.01984501, + -0.03230907, + 0.0071372404, + -0.003815232, + -0.0004167017, + -0.020135142, + -0.009290018, + 0.012197138, + 0.021260852, + 0.0043113576, + -0.02720275, + -0.017547166, + -0.02673854, + 0.024812065, + -0.01768643, + -0.008820005, + -0.01361298, + 0.042800233, + -0.012197138, + 0.02636717, + -0.012823822, + 0.012765796, + 0.023198932, + 0.013682612, + -0.012301585, + -0.008500859, + 0.0003528727, + 0.017732851, + 0.008535676, + 0.017129377, + -0.013624585, + -0.017802482, + -0.0086923465, + 0.0024748235, + -0.0097020045, + 0.0057272003, + 0.008129491, + 0.010235847, + 0.008872228, + -0.0082977675, + -0.004584081, + 0.02636717, + 0.00034144876, + 0.034235545, + -0.032494754, + -0.016270587, + 0.025624434, + -0.032076962, + 0.013601375, + 0.016096508, + 0.021678641, + 0.02847933, + 0.025299486, + -0.0069283457, + -0.003731094, + -0.0032494753, + 0.024371065, + -0.006191411, + 0.036092386, + -0.003971903, + -0.021887537, + 0.04971697, + -0.0127425855, + 0.0004464402, + -0.0021194122, + -0.0076362668, + -0.004499943, + 0.026251119, + -0.029941594, + 0.01154144, + 0.041593283, + 0.019404009, + -0.004993167, + 0.021295669, + -0.023930065, + 0.0064061084, + -0.012498874, + -0.042452075, + -0.0048161866, + 0.0012330598, + 0.009568544, + 0.006504753, + 0.0053877463, + -0.009638175, + -0.015063639, + -0.014866349, + 0.029222067, + -0.017848903, + -0.026622487, + -0.0005124452, + -0.00420691, + -0.011233901, + -0.04407681, + 0.0032436727, + 0.0015768659, + 0.010334492, + -0.0008406567, + 0.0012410384, + -0.010897348, + 0.0002165108, + 0.03630128, + -0.002846192, + -0.028757857, + -0.0015826685, + 0.010891545, + 0.007671083, + 0.005585036, + 0.0107754925, + -0.0008587899, + 0.0068819243, + 0.022154458, + -0.00047726667, + -0.011907006, + 0.020692194, + -0.017732851, + 0.011918611, + -0.005149838, + 0.0027185343, + -0.023361407, + -0.022015195, + -0.004444818, + -0.028804278, + 0.0047320486, + -0.009498913, + -0.043334074, + -0.038993705, + -0.019531667, + -0.017535562, + 0.009620768, + -0.024115749, + 0.03158954, + 0.034374807, + 0.010734874, + -0.023233749, + -0.0008246994, + 0.0041662916, + -0.009115939, + 0.026576066, + -0.01574835, + 0.0051817526, + -0.02205001, + 0.0033162057, + 0.024719223, + 0.03504791, + 0.015690323, + -0.023454249, + -0.0109379655, + 0.0137522435, + 0.005094713, + 0.013380875, + 0.008280359, + 0.058954764, + 0.006284253, + -0.007409964, + -0.012638138, + -0.008077268, + 0.0211448, + 0.029454172, + 0.021759879, + 0.002065738, + 0.016792824, + 0.011216492, + -0.010003742, + 0.03532644, + -0.025137013, + 0.0149359815, + -0.009614965, + 0.025299486, + -0.07817309, + 0.0062958584, + -0.005149838, + 0.0048451996, + 0.008883833, + 0.02980233, + 0.029268488, + 0.04447139, + -0.008228135, + -0.006545372, + -0.011222295, + 0.045098074, + -0.01945043, + 0.0015754153, + 0.02636717, + -0.012301585, + 0.019891432, + -0.0049351407, + 0.022084827, + 0.004906127, + 0.02590296, + 0.008895438, + -0.029245278, + -0.023396222, + 0.044192865, + 0.029245278, + 0.02286238, + -0.021841116, + 0.012336401, + -0.042312812, + 0.013125559, + -0.010769689, + -0.012231953, + -0.03534965, + -0.03110212, + -0.005817141, + 0.04618897, + -0.02160901, + 0.004856805, + 0.014065586, + 0.006777477, + 0.015736744, + -0.008408017, + 0.018487193, + 0.042846654, + 0.004172094, + 0.022212485, + -0.0030115673, + 0.010949572, + -0.0076420694, + 0.0072765034, + -0.043241233, + 0.02889712, + 0.026692118, + -0.009539531, + 0.0152725335, + 0.012266769, + 0.007235885, + 0.030080857, + -0.006261043, + 0.01270777, + 0.019311167, + -0.013346059, + 0.013856691, + -0.0052658906 + ], + "Category": "Luxury", + "Tags": [ + "bar", + "concierge", + "restaurant" + ] + } + ] +} \ No newline at end of file diff --git a/sdk/search/azure-search-documents/samples/data/query_vector.json b/sdk/search/azure-search-documents/samples/data/query_vector.json new file mode 100644 index 000000000000..168dca84dd99 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/data/query_vector.json @@ -0,0 +1,1538 @@ +[ + -0.045507785, + 0.028645637, + 0.014222746, + -0.018325701, + -0.020214563, + -0.038177505, + 0.015761355, + 0.047784425, + 0.010457533, + -0.042280458, + 0.046658613, + 0.0010140118, + 0.008381038, + -0.009988446, + 0.0053694933, + 0.05784167, + 0.004900405, + 0.011414473, + 0.037527036, + 0.08145868, + 0.0048034606, + -0.036801513, + -0.059943184, + -0.020614851, + -0.01619917, + 0.032973755, + -0.03532545, + -0.013622314, + 0.009012743, + -0.010657678, + -0.03354917, + -0.041229703, + 0.004687752, + -0.09882119, + 0.057391346, + 0.019413985, + -0.010832804, + -0.010069754, + 0.031922996, + -0.0033805603, + 0.010926622, + 0.0031381983, + 0.048660055, + -0.0047846967, + 0.011595854, + 0.001674644, + 0.03645126, + 0.034374762, + -0.030922277, + -0.012765447, + -0.01850083, + -0.053588606, + -0.00835602, + -0.06674808, + -0.013834967, + 0.008368528, + 0.01100793, + -0.004475099, + 0.07610483, + 0.0130844265, + 0.00012381967, + -0.0016246078, + 0.013859984, + 0.049685795, + 0.023642031, + 0.042455584, + -0.008443583, + 0.024104865, + -0.055990335, + -0.015673792, + 0.009100306, + -0.03972862, + -0.043931648, + 0.0052350215, + 0.06809906, + -0.0184633, + -0.003202307, + 0.0057729087, + 0.009606921, + -0.018625919, + 0.0040091383, + -0.016599458, + -0.0022719493, + -0.004809715, + -0.0045595346, + -0.052087523, + -0.041980244, + -0.000460488, + -0.034574907, + 0.048359837, + 0.03342408, + -0.014598017, + 0.026343979, + -0.058291994, + -0.016737057, + 0.0073052626, + 0.020539798, + -0.010194845, + -0.033499133, + -0.014635543, + 0.037502017, + -0.089964814, + 0.0035807046, + -0.037176784, + -0.0020061329, + -0.0072990083, + 0.024117375, + 0.02090256, + 0.022853965, + -0.0027723096, + -0.0719018, + 0.02684434, + 0.010957894, + 0.024254974, + -0.039953783, + 0.055740155, + -0.01708731, + -0.016962219, + 0.01481067, + 0.05934275, + 0.019701693, + 0.021102702, + -0.008024531, + -0.035150323, + -0.00784315, + -0.042105332, + -0.04695883, + -0.014410381, + -0.056740876, + -0.04115465, + 0.0025393295, + 0.02847051, + 0.020552306, + 0.01456049, + -0.034224655, + -0.017149854, + -0.015923971, + -0.02254124, + -0.041054577, + -0.00031116165, + -0.00522564, + -0.015798882, + 0.011233092, + -0.027669935, + 0.014535472, + 0.020777468, + 0.019914346, + 0.017762797, + 0.017537635, + 0.040354073, + 0.0073115174, + -0.012790465, + -0.0087375445, + 0.009544376, + -0.06434636, + -0.013222026, + -0.024079848, + -0.019964382, + -0.024530172, + 0.023979776, + -0.055740155, + -0.024830388, + -0.016549421, + 0.03770216, + 0.020152017, + -0.049185432, + -0.020402199, + 0.041304756, + -0.074503675, + -0.050211173, + 0.06669805, + 0.0069675194, + -0.035875846, + 0.06894967, + -0.0031585253, + 0.0018700972, + 0.0086062, + -0.0059386534, + -0.02696943, + -0.007793114, + 0.0016246078, + -0.04463215, + -0.0043687723, + 0.031922996, + 0.03975364, + 0.06309546, + -0.035900865, + 0.015160922, + -0.037276853, + 0.011752216, + -0.04795955, + 0.00068017753, + -0.002251622, + 0.003399324, + 0.044982407, + 0.01107673, + -0.017012255, + 0.01045128, + 0.010207353, + 0.027419753, + -0.060293436, + -0.02139041, + 0.028745709, + -0.0027300918, + -0.03987873, + -0.032323286, + 0.011764726, + -0.015873935, + -0.034850106, + -0.05243778, + -0.0066860667, + -0.0030224898, + 0.032098126, + 0.033924438, + -0.0139725655, + -0.007993259, + -0.00170748, + 0.030471953, + -2.3869736e-05, + 0.06764873, + 0.0009757029, + -0.008087076, + 0.01657444, + 0.0445571, + 0.033198915, + 0.07735573, + -0.01850083, + -0.048359837, + 0.0055070925, + -0.015773864, + -0.0040028836, + 0.015486157, + -0.017174874, + -0.021365391, + -0.032998774, + 0.043506343, + 0.0076367515, + 0.016737057, + 0.020602342, + -0.0445571, + -0.08651233, + -0.03227325, + -0.033949457, + 0.00597618, + 0.02922105, + 0.0013275188, + -0.00064225955, + -0.03154773, + 0.02315418, + 0.017600179, + -0.025230676, + 0.067048304, + -0.039928764, + 0.00629516, + 0.011445746, + -0.015986517, + 0.0032116887, + 0.028320402, + 0.014385363, + -0.021553027, + 0.05101175, + -0.025355767, + 0.025030533, + 0.0003373524, + 0.023216726, + 0.005638437, + 0.01786287, + -0.01669953, + 0.006267015, + -0.024517663, + -0.06279524, + -0.024217447, + -0.043581396, + -0.0020405324, + 0.009613176, + -0.014698089, + -0.011777234, + -0.013146971, + 0.060293436, + 0.0066610486, + -0.031422637, + -2.5958641e-07, + 0.024267482, + -0.005466438, + -0.020427216, + 0.00328987, + 0.0147731425, + -0.0139725655, + -0.030421916, + 0.0045313896, + -0.01708731, + -0.023016581, + -0.0058166906, + -0.040304035, + 0.0016902802, + -0.0015331358, + 0.0033836877, + -0.053738713, + 0.032223213, + -0.002925545, + 0.0038871753, + 0.06879956, + -0.02784506, + -0.0060043256, + -0.0061982153, + 0.020990122, + 0.023266762, + -0.0074366075, + 0.030046646, + 0.019976892, + 0.008055803, + 0.03304881, + -0.031347584, + 0.010394989, + -0.009907138, + -0.0369266, + -0.026394015, + 0.015361066, + -0.020990122, + -0.04620829, + 0.07900692, + 0.027669935, + 0.019639147, + -0.02329178, + -0.023617014, + -0.009681975, + -0.03530043, + -0.021615572, + -0.025505874, + -0.016849639, + 0.02329178, + -0.02809524, + -0.039428405, + 0.069149815, + -0.009200378, + 0.020990122, + -0.040304035, + -0.018675955, + 0.039428405, + 0.077505834, + -0.09551881, + -0.01797545, + 0.016336769, + -0.025343258, + -0.0009131578, + 0.003586959, + 0.012746682, + 0.027294664, + 0.011014185, + 0.049335543, + -0.059893146, + -0.008318493, + -0.0023423124, + 0.038377646, + -0.0064609046, + -0.031697836, + 0.052587885, + -0.010764005, + -0.004265573, + 0.046758685, + -0.030722132, + -0.010588879, + 0.017887887, + -0.017112328, + -0.019701693, + -0.0155737195, + 0.014185219, + -0.012471485, + -0.07105119, + -0.0019373331, + 0.0072302087, + 0.05198745, + 0.011045457, + -0.017637707, + 0.019476531, + 0.068299204, + 0.04745919, + 0.059292715, + 0.030797187, + -0.00052342395, + 0.013096935, + -0.022916509, + 0.013359624, + -0.016249206, + 0.053438496, + 0.0011015749, + -0.051236913, + -0.010445025, + -0.06694823, + 0.0098821195, + 0.022428658, + -0.0102824075, + -0.01669953, + -0.0112831285, + 0.019914346, + -0.031597763, + 0.017500108, + -0.0066860667, + -0.0053851297, + 0.0011523927, + 0.0044688443, + -0.026469069, + -0.0013799004, + 0.012777955, + -0.0054820743, + -0.021027649, + 0.0031553982, + -0.024342537, + -0.03444982, + 0.0110266935, + 0.025793582, + -0.00905027, + 0.04075436, + -0.009681975, + 0.0049660774, + -0.026118817, + -0.0075992243, + -0.071651615, + 0.01960162, + 0.059642967, + 0.015661282, + -0.015898954, + -0.019138787, + 0.026243906, + -0.043231145, + 0.007061337, + 0.0025565294, + -0.02784506, + -0.09401773, + -0.01367235, + -0.009913391, + -0.047108937, + 0.032298267, + 0.05659077, + -0.034124583, + -0.02937116, + -0.033699278, + -0.022578767, + 0.0059417807, + -0.017387526, + 0.02200335, + -0.042080317, + -0.025718529, + -0.021815715, + -0.04658356, + -0.019076243, + 0.020414706, + 0.035400502, + 0.00734279, + -0.04408176, + -0.037251838, + 0.014485436, + -0.009056524, + -0.024642752, + 0.027169574, + 0.0072114454, + 0.045132514, + -0.019413985, + -0.033298988, + -0.018250648, + 0.063695885, + 0.013134462, + -0.004350009, + 0.020051945, + 0.022503711, + -0.024492646, + 0.0010015027, + 0.01045128, + 0.036426242, + -0.07550439, + 0.0036088498, + -0.07570454, + 0.0058385814, + -0.033824366, + -0.06349574, + -0.028020186, + -0.023066618, + 0.025893655, + 0.007799369, + 0.015423612, + -0.041579954, + -0.02090256, + 0.017450072, + -0.0061169066, + 0.00029669813, + -0.014648053, + -0.004934805, + 0.037151765, + -0.040679306, + 0.023429379, + -0.00670483, + 0.009325468, + 0.01189607, + -0.013509733, + -0.0053601116, + 0.057691563, + -0.031998053, + 0.015273503, + -0.0006051234, + 0.0041811373, + -0.009256668, + -0.013272061, + -0.014247764, + 0.0037745943, + 0.030321844, + 0.039303314, + -0.053338427, + 0.01786287, + 0.05088666, + 0.006711085, + -0.0016652622, + 0.020064455, + -0.014185219, + 0.015498665, + 0.0042843367, + 0.015110886, + -0.002181259, + 0.044156812, + 0.0033680515, + 0.0022000223, + 0.0064358865, + 0.024955478, + 0.016536914, + 0.0074115894, + 0.019801766, + 0.037877288, + 0.022853965, + -0.122988604, + 0.0036463768, + -0.041029558, + 0.002875509, + 0.033824366, + -0.02494297, + 0.015898954, + 0.011921088, + 0.064946786, + 0.029546285, + -0.016436841, + 0.010376225, + -0.033749312, + 0.0129093, + -0.018625919, + -0.0476093, + 0.0029443086, + -0.017475089, + -0.05013612, + -0.019801766, + -0.010651424, + 0.03557563, + 0.04530764, + 0.014097656, + 0.020965103, + -0.0060981433, + 0.004065429, + 0.0067673754, + -0.014397873, + -0.0137724215, + -0.0017684615, + 0.012208795, + 0.035375483, + -0.045107495, + -0.0148607055, + 0.017112328, + 0.013834967, + 0.0019576603, + 0.011996143, + 0.026619177, + 0.031647798, + -0.019439004, + 0.0061763246, + -0.01253403, + 0.023004072, + -0.021678118, + -0.017925413, + 0.03785227, + 0.0072114454, + 0.003299252, + -0.007855659, + 0.0073052626, + 0.0075491886, + 0.010601387, + 0.00923165, + -0.0067486116, + 0.008205912, + -0.008062058, + -0.00064734137, + -0.00012714238, + -0.013259552, + 0.0012532466, + 0.018163085, + 0.015498665, + 0.023504432, + -0.008305984, + -0.0627452, + -0.0028473637, + 0.030572025, + -0.012759192, + 0.009069033, + -0.025618456, + -0.017287454, + 0.00809333, + 0.023854686, + 0.015323539, + 0.014748124, + -0.001452609, + 0.0052350215, + -0.044106774, + 0.004709643, + 0.0034524873, + -0.0022172222, + 0.001502645, + -0.03254845, + -0.003027181, + -0.01847581, + 0.025168132, + -0.021077685, + -0.017575162, + -0.0105388425, + 0.012265086, + 0.0025471475, + 0.008631218, + -0.023066618, + 0.01644935, + 0.059592932, + -0.013297079, + 0.03149769, + 0.018125558, + -0.042980965, + 0.0014229001, + -0.0048253513, + -0.017687742, + 0.068299204, + 0.026769284, + -0.024630243, + -0.023829667, + -0.027369717, + -0.008399801, + -0.007699297, + -0.0088251075, + -0.0072114454, + 0.013947548, + 0.005491456, + 0.025280712, + -0.02252873, + 0.05834203, + -0.009275432, + -0.0035494321, + -0.00068369566, + 0.008218421, + -0.012802973, + -0.018325701, + -0.0043343725, + 0.012258831, + 0.0034556144, + -0.00091237604, + 0.034099564, + 0.020915067, + 0.0011907015, + 0.00039696565, + 0.011514545, + 0.017675234, + -0.0049129142, + -0.016599458, + -0.0015972444, + -0.04570793, + 0.035750754, + 0.013322097, + -0.01960162, + -0.03887801, + 0.00956314, + 0.08015775, + 0.025718529, + 0.02999661, + 0.010976657, + 0.030146718, + 0.012884282, + 0.016311752, + -0.0011500473, + -0.015711319, + 0.0070988643, + 0.044532083, + -0.0039372114, + -0.028295385, + -0.018813554, + -0.024355046, + -0.030972313, + 0.0060762526, + 0.014247764, + 0.019476531, + -0.012527775, + -0.0035775774, + -0.01606157, + 0.05073655, + 0.020202054, + -0.022691347, + 4.3830405e-05, + 0.0034368508, + -0.041229703, + 0.006404614, + -0.06419625, + 0.0021359138, + 0.022503711, + 0.008806344, + -0.07290252, + 0.004118592, + -0.009044016, + -0.013059408, + -0.036801513, + 0.03735191, + -0.00091706694, + 0.004981714, + -0.024204938, + -0.012333886, + 0.014497944, + -0.011583345, + -0.0516372, + -0.021540519, + 0.015798882, + 0.0013126644, + 0.00924416, + 0.017950432, + 0.013497223, + 0.019576604, + -0.0065109404, + -0.013784931, + 0.028245348, + 0.019226352, + -0.02254124, + -0.0062107244, + 0.040203962, + -0.002381403, + -0.030471953, + -0.0075867157, + 0.050411317, + -0.028320402, + -0.005729127, + -0.027820041, + 0.0051412038, + -0.009100306, + -0.011514545, + -0.00617007, + -0.008868889, + 0.005453929, + -0.014510454, + 0.009513103, + 0.0057134912, + 0.0125715565, + -0.014910742, + -0.044732224, + -0.037802234, + -0.010420007, + 0.009388013, + 0.006592249, + -0.004443826, + -0.0133721335, + -0.072452195, + -0.016499387, + -0.03274859, + 0.006326433, + 0.008568673, + 0.032873683, + -0.00082090386, + 0.033499133, + 0.047759406, + 0.018901117, + 0.010307426, + 0.015135904, + 0.006173197, + -0.024505153, + 0.00044993352, + -0.009094051, + -0.02684434, + 0.0030396897, + -0.026569141, + 0.028395457, + -0.032223213, + 0.006132543, + -0.0054820743, + 0.006254506, + -0.025493365, + 0.013559769, + -0.013209516, + -0.007542934, + -0.020001909, + -0.055139724, + 0.0135722775, + -0.00551022, + -0.022678837, + 0.008487364, + 0.03857779, + -0.009075288, + -0.03785227, + 0.009544376, + -0.038402665, + 0.02329178, + -0.02037718, + -0.011677163, + -0.016399315, + 0.05759149, + -0.006611013, + 0.02139041, + -0.0058166906, + 0.008599945, + -0.013847476, + 0.026669214, + -0.016511895, + -0.018713482, + -0.022291059, + 0.012246323, + -0.02100263, + -0.014923251, + 0.00037097037, + -0.003085035, + -0.014885724, + 0.025918672, + 0.0057197455, + -0.028170295, + 0.024480136, + -0.007530425, + -0.005181858, + -0.019038716, + -0.048509948, + 0.016136626, + 0.025243185, + -0.01973922, + 0.0036119772, + -0.011470764, + 0.01569881, + 0.0058073085, + -0.01621168, + -0.022616293, + -0.011633381, + 0.01632426, + 0.023617014, + -0.001389282, + -0.018713482, + 0.023867194, + -0.0011993014, + -0.024892934, + -0.00021656226, + 0.012996863, + 0.031847943, + -0.026544122, + -0.027394736, + -0.012746682, + -0.01340966, + 0.0213779, + 0.022453675, + -0.019188823, + -0.01043877, + -0.018638426, + 0.003977866, + 0.017187381, + -0.015198449, + -0.0020358416, + -0.021290338, + -0.019964382, + -0.03592588, + -0.022090914, + -0.024367554, + 0.007780605, + 0.023829667, + -0.0014135183, + 0.031147439, + -0.017362509, + 0.03862783, + 0.016924692, + 0.03189798, + 0.006598504, + -0.05909257, + -0.04403172, + -0.002888018, + -0.0033680515, + -0.014635543, + 0.013434678, + -0.026343979, + -0.0012985917, + 0.0007356862, + 0.004628334, + 0.02558093, + 0.027169574, + 0.0065359585, + -0.005960544, + 0.013484715, + -0.0106264055, + 0.009350486, + -0.037301872, + 0.060593653, + 0.031722855, + 0.011508291, + 0.00011013794, + 0.042830855, + 0.022190986, + 0.0033586696, + -0.053588606, + -0.02455519, + -0.0046439706, + 0.015110886, + -0.007961986, + -0.010764005, + 0.025893655, + -0.022378622, + 0.0045720437, + 0.02594369, + 0.02847051, + -0.015235976, + -0.011458254, + 0.02036467, + -0.023479415, + 0.005206876, + -0.008299729, + -0.026469069, + -0.019989401, + -0.009200378, + 0.0048441147, + 0.0067861388, + -0.013747403, + 0.015748845, + 0.0006074689, + -0.019251369, + -0.0018450792, + 0.0098821195, + -0.03757707, + 0.015611246, + -0.007924459, + 0.0038652846, + -0.01733749, + -0.020026928, + 0.021703135, + 0.00028399366, + -0.0036651404, + -0.013634822, + -0.022065897, + -0.027419753, + 0.043206125, + -0.021177758, + 0.028770726, + 0.00017737388, + -0.013109445, + 0.02681932, + -0.013997584, + -0.011158038, + 0.025280712, + -0.023054108, + 0.01810054, + -0.033874404, + -0.013759913, + 0.008618709, + 0.040579233, + -0.04465717, + 0.046508506, + -0.01911377, + 0.014135183, + 0.0043468815, + -0.0359509, + 0.01644935, + -0.011933597, + -0.0005199058, + 0.004190519, + -0.00759297, + 0.02696943, + 0.041429847, + -0.012365158, + -0.01669953, + 0.012959336, + 0.044857316, + 0.0015268812, + 0.036376204, + -0.012946827, + 0.015748845, + -0.019901838, + 0.0110829845, + 0.013021881, + -0.01043877, + -0.010463788, + 0.0014979541, + 0.0066547943, + 0.0359509, + 0.002905218, + -0.046858758, + 0.04368147, + 0.0503863, + 0.04720901, + 0.041304756, + 0.031147439, + 0.027920114, + 0.005563383, + 0.049285505, + 0.017274946, + -0.024792861, + -0.010707714, + 0.00923165, + -0.0105388425, + 0.020802487, + -0.0060981433, + 0.008368528, + 0.0019388968, + -0.026368996, + 0.013522241, + 0.043581396, + -0.03177289, + 0.0017528252, + -0.027920114, + -0.00689872, + -0.034099564, + -0.032448377, + -0.002855182, + 0.04745919, + -0.032698557, + -0.013284571, + -0.01923886, + 0.014598017, + 0.0126278475, + -0.048635036, + 0.003077217, + -0.0015925536, + 0.0033711786, + -0.0044188085, + 0.010101027, + 0.034524873, + 0.012077451, + 0.0031835434, + -0.0033430334, + -0.007255227, + 0.019589113, + -0.004328118, + 0.045007423, + -0.024605226, + 0.04090447, + -0.015974008, + -0.00087719446, + 0.006861193, + 0.027419753, + 0.028445492, + -0.006442141, + 0.015723828, + -0.0028645636, + -0.0148607055, + -0.015811391, + 0.028195312, + 0.005872981, + 0.015548701, + 0.02316669, + 0.008030785, + -0.0258186, + -0.01543612, + 0.01783785, + 0.009769538, + 0.043831576, + 0.012659119, + -0.0141727105, + -0.008074567, + -0.015398594, + -0.036025953, + -0.0058667264, + 0.0025299476, + 9.230283e-05, + 0.002695692, + -0.020189544, + 0.009419286, + 0.002695692, + 0.016511895, + -0.010914112, + -0.051061787, + -0.015473647, + -0.01506085, + -0.0038215031, + 0.02784506, + -0.016149133, + 0.0052475305, + 0.023967266, + -0.004859751, + -0.0036495042, + -0.007392826, + 0.0023532577, + -0.032573465, + -0.0242925, + 0.0034087056, + -0.003621359, + -0.011602108, + -0.0027598008, + 0.001540172, + 0.013484715, + 0.0022719493, + -0.014160201, + 0.008675, + 0.0102824075, + 0.020477252, + -0.014948268, + -0.0031991797, + -0.002121841, + 0.019889329, + -0.0007548407, + -0.022891492, + 0.018263157, + -0.0015902082, + 0.0062388694, + 0.015073359, + -0.0062982873, + -0.016949711, + -0.004265573, + 0.017112328, + 0.00057267817, + -0.030346863, + 0.0018904244, + -0.0100635, + -0.004972332, + -0.010107282, + -0.0061294157, + 0.027995167, + 0.007693042, + -0.012540285, + -0.004697134, + 0.042205404, + -0.015298521, + 0.0015761355, + 0.010857822, + -0.017249927, + -0.016399315, + 0.001469027, + -0.03762711, + -0.04152992, + 0.027244627, + 0.0004737788, + -0.017637707, + 0.017700251, + -0.016399315, + 0.00094443036, + -0.02100263, + 0.009832083, + 0.030446934, + -0.021765681, + -0.00040615196, + -0.019226352, + -0.028145276, + -0.03467498, + 0.012102469, + 0.0062763966, + 0.0033555424, + 0.014535472, + -0.006107525, + 0.017562652, + -0.010939131, + -0.03820252, + 0.039328333, + 0.01100793, + -0.012996863, + 0.061844554, + 0.022929018, + -0.0012149378, + -0.0062513785, + -0.011039203, + 0.0025596565, + 0.016987238, + -0.004537644, + -0.008975216, + 0.019313915, + 0.001059357, + 0.006698576, + 0.017437562, + -0.0131719895, + 0.008268457, + -0.022941528, + 0.009975937, + 0.02518064, + -0.015898954, + -0.029971592, + -0.008143366, + -0.0027707461, + 0.024993006, + 0.009119069, + -0.016787093, + -0.025243185, + -0.005973053, + 0.012171268, + 0.004772188, + -0.0012845191, + -0.0002779346, + -0.029020907, + -0.034249675, + -0.017387526, + 0.02022707, + 0.007455371, + -0.00024451208, + -0.029896537, + 0.011039203, + -0.014022602, + 0.027569862, + 0.028445492, + -0.025505874, + -0.017550142, + -0.0046564797, + 0.038552772, + -0.029846502, + -0.011001675, + -0.010401243, + 0.011477018, + -0.0045845527, + 0.021352883, + 0.02505555, + 0.011495782, + -0.013522241, + -0.047784425, + 0.019476531, + -0.004350009, + 0.009794557, + 0.004909787, + -0.018075522, + -0.0213779, + -0.009006488, + -0.023516942, + 0.011408218, + -0.0427558, + -0.048635036, + 0.025593437, + 0.00172468, + 0.00023591214, + -0.010294916, + 0.0063639595, + 0.025843618, + -0.033073828, + 0.0006019962, + 0.024054829, + 0.028045204, + 0.046658613, + 0.0037996122, + -0.050561424, + -0.005034877, + 0.014422891, + 0.008787581, + 0.0016042808, + 0.0012337012, + 0.015286013, + 0.0021937678, + -0.0032210704, + 0.038052414, + 0.026168853, + 0.026168853, + -0.01481067, + -0.015661282, + -0.005256912, + -0.025480857, + -0.0029396177, + 0.0010820295, + 0.004794079, + -0.035000216, + -0.026444051, + 0.008818854, + 0.006973774, + 0.012821737, + 0.006054362, + -0.024655262, + -0.0069049746, + -0.0029396177, + -0.007936968, + 0.03404953, + 0.010545096, + -0.011433236, + -0.00061763247, + 0.0059292717, + -0.052487813, + -0.008531146, + -0.009656957, + -0.02266633, + -0.022828946, + -0.002930236, + 0.015673792, + -0.0046658614, + -0.011739708, + 0.01619917, + -0.015035832, + 0.02594369, + -0.007868168, + 0.022065897, + 0.04110461, + -0.014623035, + -0.012602829, + 0.003349288, + -0.016349278, + 0.0027598008, + -0.00092723046, + -0.030797187, + -0.004503244, + -0.0242925, + 0.008174639, + 0.021452954, + -0.007555443, + -0.00446259, + 0.035275415, + -0.0029896537, + 0.011133021, + 0.027644916, + -0.008637473, + -0.023429379, + -0.0021859498, + 0.011289383, + -0.0007571861, + -0.026394015, + 0.024880424, + -0.0071926815, + -0.03377433, + 0.040429126, + 0.03667642, + 0.011733453, + -0.009388013, + 0.009075288, + -0.015361066, + -0.0035150324, + -0.0095381215, + -0.015085868, + 0.0043844087, + 0.023004072, + -0.027669935, + 0.0172124, + 0.000673923, + -0.0057134912, + 0.019313915, + -0.002875509, + 0.016636986, + -0.016286733, + -0.0142978, + -0.0034431054, + -0.012665374, + -0.030547006, + -0.02075245, + -0.0046596066, + -0.019188823, + -7.246431e-05, + -0.0013908457, + -0.011014185, + 0.004834733, + 0.038127467, + 0.0057322546, + -0.015498665, + 0.003977866, + 0.04668363, + -0.012252577, + 0.023341816, + -0.0011164293, + 0.0050036046, + 0.023504432, + -0.0035025233, + 0.019026207, + -0.013397152, + 0.0054414202, + -0.029496249, + -0.016549421, + -0.016024044, + -0.010576369, + -0.009738266, + -0.010244881, + 0.022378622, + -0.0016433714, + -0.011376946, + 0.028445492, + -0.0184633, + -0.00471277, + -0.020990122, + 0.0068549383, + -0.0024001666, + 0.022378622, + 0.015336048, + 0.01619917, + -0.026143834, + 0.0498359, + 0.0054132747, + 0.02379214, + -0.017012255, + -0.049810883, + -0.021615572, + -0.0054101474, + 0.0063764686, + 0.005106804, + 0.022266041, + 0.010989167, + -0.0052850572, + -0.025318239, + -0.009400522, + 0.0071864272, + 0.028195312, + -0.02505555, + 0.022053387, + 0.0023876575, + 0.009688229, + -0.03444982, + 0.019013697, + -0.0045814253, + 0.009769538, + -0.034599926, + 0.009957173, + -0.023379343, + -0.0041592466, + -0.011014185, + 0.026644194, + 0.011301892, + -0.023316797, + 0.012734174, + -0.0140851475, + 0.013272061, + 0.00042530638, + -0.03760209, + -0.021077685, + -0.019926855, + 0.010088518, + -0.011539564, + -0.0100259725, + -0.042455584, + -0.021815715, + 0.00029865265, + -0.03960353, + 0.0044719717, + 0.0027738733, + -0.006611013, + 0.0013986639, + 0.008518637, + -0.011852289, + 0.036776494, + -0.0030084173, + 0.0019858056, + -0.013872494, + -0.019789256, + -0.014035111, + -0.0049785865, + -0.0005969144, + -0.0023454397, + 0.028645637, + -0.001619917, + -0.036126025, + 0.010995422, + 0.023591995, + -0.054088965, + 0.0063514505, + -0.02468028, + 0.022253532, + 0.010457533, + 0.00019721239, + -0.024455117, + -0.033098843, + 0.036751475, + -0.01607408, + 0.0026268924, + -0.033899423, + -0.007355299, + -0.014185219, + -0.015773864, + -0.004728406, + 0.009488085, + 0.021415427, + 0.03847772, + -0.044356953, + 0.031047367, + 0.009732011, + 0.038402665, + 0.011989888, + 0.011452001, + 0.0034399782, + 0.017575162, + 0.01975173, + -0.02504304, + 0.00011160384, + 0.0059261443, + -0.0026253287, + -0.04430692, + 0.038652845, + 0.026644194, + -0.0102824075, + 0.021690626, + -0.015798882, + -0.020139508, + -0.012033669, + 0.004806588, + -0.063295595, + 0.0036495042, + 0.010982912, + -0.020602342, + 0.0027363463, + 0.033699278, + 0.0074866433, + 0.03820252, + -0.015135904, + -0.0066673034, + -0.046858758, + 0.012458975, + -0.0012243196, + 0.009169105, + -0.0028567456, + -0.0049410597, + 0.017037274, + -0.023529451, + 0.017700251, + -0.01708731, + 0.0244301, + 0.02962134, + -0.013684859, + 0.035500575, + 0.043506343, + -0.0036276134, + 0.022753892, + 0.0038934299, + -0.0014002275, + -0.005622801, + 0.025218168, + -0.0040497924, + 0.017750287, + -0.022416148, + -0.003172598, + 0.010213608, + 9.0836926e-05, + 0.004884769, + -0.013534751, + -0.010663932, + -0.0033461605, + -0.01431031, + -0.017074801, + 0.0045908075, + 0.03407455, + -0.0054883286, + 0.009694484, + 0.018175595, + -0.012515266, + -0.0001456127, + -0.0044719717, + 0.0029615085, + 0.008556164, + 0.017887887, + -0.027744988, + -0.0035588138, + -0.010782768, + 0.021165248, + -0.05634059, + 0.0041404827, + 0.019639147, + 0.022178477, + -0.03645126, + 0.0048128422, + -0.006132543 +] \ No newline at end of file diff --git a/sdk/search/azure-search-documents/samples/synonym_map.txt b/sdk/search/azure-search-documents/samples/data/synonym_map.txt similarity index 100% rename from sdk/search/azure-search-documents/samples/synonym_map.txt rename to sdk/search/azure-search-documents/samples/data/synonym_map.txt diff --git a/sdk/search/azure-search-documents/samples/files/hotel_small.json b/sdk/search/azure-search-documents/samples/files/hotel_small.json deleted file mode 100644 index e30a1f96199b..000000000000 --- a/sdk/search/azure-search-documents/samples/files/hotel_small.json +++ /dev/null @@ -1,252 +0,0 @@ -[ - { - "@search.action": "upload", - "hotelId": "1", - "hotelName": "Fancy Stay", - "description": "Best hotel in town if you like luxury hotels. They have an amazing infinity pool, a spa, and a really helpful concierge. The location is perfect -- right downtown, close to all the tourist attractions. We highly recommend this hotel.", - "descriptionFr": "Meilleur hôtel en ville si vous aimez les hôtels de luxe. Ils ont une magnifique piscine à débordement, un spa et un concierge très utile. L'emplacement est parfait – en plein centre, à proximité de toutes les attractions touristiques. Nous recommandons fortement cet hôtel.", - "category": "Luxury", - "tags": [ - "pool", - "view", - "wifi", - "concierge" - ], - "parkingIncluded": false, - "smokingAllowed": false, - "lastRenovationDate": "2010-06-27T00:00:00+00:00", - "rating": 5, - "location": { - "type": "Point", - "coordinates": [ - -122.131577, - 47.678581 - ] - } - }, - { - "@search.action": "upload", - "hotelId": "2", - "hotelName": "Roach Motel", - "description": "Cheapest hotel in town. Infact, a motel.", - "descriptionFr": "Hôtel le moins cher en ville. Infact, un motel.", - "category": "Budget", - "tags": [ - "motel", - "budget" - ], - "parkingIncluded": true, - "smokingAllowed": true, - "lastRenovationDate": "1982-04-28T00:00:00+00:00", - "rating": 1, - "location": { - "type": "Point", - "coordinates": [ - -122.131577, - 49.678581 - ] - } - }, - { - "@search.action": "upload", - "hotelId": "3", - "hotelName": "EconoStay", - "description": "Very popular hotel in town", - "descriptionFr": "Hôtel le plus populaire en ville", - "category": "Budget", - "tags": [ - "wifi", - "budget" - ], - "parkingIncluded": true, - "smokingAllowed": false, - "lastRenovationDate": "1995-07-01T00:00:00+00:00", - "rating": 4, - "location": { - "type": "Point", - "coordinates": [ - -122.131577, - 46.678581 - ] - } - }, - { - "@search.action": "upload", - "hotelId": "4", - "hotelName": "Express Rooms", - "description": "Pretty good hotel", - "descriptionFr": "Assez bon hôtel", - "category": "Budget", - "tags": [ - "wifi", - "budget" - ], - "parkingIncluded": true, - "smokingAllowed": false, - "lastRenovationDate": "1995-07-01T00:00:00+00:00", - "rating": 4, - "location": { - "type": "Point", - "coordinates": [ - -122.131577, - 48.678581 - ] - } - }, - { - "@search.action": "upload", - "hotelId": "5", - "hotelName": "Comfy Place", - "description": "Another good hotel", - "descriptionFr": "Un autre bon hôtel", - "category": "Budget", - "tags": [ - "wifi", - "budget" - ], - "parkingIncluded": true, - "smokingAllowed": false, - "lastRenovationDate": "2012-08-12T00:00:00+00:00", - "rating": 4, - "location": { - "type": "Point", - "coordinates": [ - -122.131577, - 48.678581 - ] - } - }, - { - "@search.action": "upload", - "hotelId": "6", - "description": "Surprisingly expensive. Model suites have an ocean-view." - }, - { - "@search.action": "upload", - "hotelId": "7", - "hotelName": "Modern Stay", - "description": "Modern architecture, very polite staff and very clean. Also very affordable.", - "descriptionFr": "Architecture moderne, personnel poli et très propre. Aussi très abordable." - }, - { - "@search.action": "upload", - "hotelId": "8", - "description": "Has some road noise and is next to the very police station. Bathrooms had morel coverings.", - "descriptionFr": "Il y a du bruit de la route et se trouve à côté de la station de police. Les salles de bain avaient des revêtements de morilles." - }, - { - "@search.action": "upload", - "hotelId": "9", - "hotelName": "Secret Point Motel", - "description": "The hotel is ideally located on the main commercial artery of the city in the heart of New York. A few minutes away is Time's Square and the historic centre of the city, as well as other places of interest that make New York one of America's most attractive and cosmopolitan cities.", - "descriptionFr": "L'hôtel est idéalement situé sur la principale artère commerciale de la ville en plein cœur de New York. A quelques minutes se trouve la place du temps et le centre historique de la ville, ainsi que d'autres lieux d'intérêt qui font de New York l'une des villes les plus attractives et cosmopolites de l'Amérique.", - "category": "Boutique", - "tags": [ - "pool", - "air conditioning", - "concierge" - ], - "parkingIncluded": false, - "smokingAllowed": true, - "lastRenovationDate": "1970-01-18T00:00:00-05:00", - "rating": 4, - "location": { - "type": "Point", - "coordinates": [ - -73.975403, - 40.760586 - ] - }, - "address": { - "streetAddress": "677 5th Ave", - "city": "New York", - "stateProvince": "NY", - "country": "USA", - "postalCode": "10022" - }, - "rooms": [ - { - "description": "Budget Room, 1 Queen Bed (Cityside)", - "descriptionFr": "Chambre Économique, 1 grand lit (côté ville)", - "type": "Budget Room", - "baseRate": 9.69, - "bedOptions": "1 Queen Bed", - "sleepsCount": 2, - "smokingAllowed": true, - "tags": [ - "vcr/dvd" - ] - }, - { - "description": "Budget Room, 1 King Bed (Mountain View)", - "descriptionFr": "Chambre Économique, 1 très grand lit (Mountain View)", - "type": "Budget Room", - "baseRate": 8.09, - "bedOptions": "1 King Bed", - "sleepsCount": 2, - "smokingAllowed": true, - "tags": [ - "vcr/dvd", - "jacuzzi tub" - ] - } - ] - }, - { - "@search.action": "upload", - "hotelId": "10", - "hotelName": "Countryside Hotel", - "description": "Save up to 50% off traditional hotels. Free WiFi, great location near downtown, full kitchen, washer & dryer, 24/7 support, bowling alley, fitness center and more.", - "descriptionFr": "Économisez jusqu'à 50% sur les hôtels traditionnels. WiFi gratuit, très bien situé près du centre-ville, cuisine complète, laveuse & sécheuse, support 24/7, bowling, centre de fitness et plus encore.", - "category": "Budget", - "tags": [ - "24-hour front desk service", - "coffee in lobby", - "restaurant" - ], - "parkingIncluded": false, - "smokingAllowed": true, - "lastRenovationDate": "1999-09-06T00:00:00+00:00", - "rating": 3, - "location": { - "type": "Point", - "coordinates": [ - -78.940483, - 35.90416 - ] - }, - "address": { - "streetAddress": "6910 Fayetteville Rd", - "city": "Durham", - "stateProvince": "NC", - "country": "USA", - "postalCode": "27713" - }, - "rooms": [ - { - "description": "Suite, 1 King Bed (Amenities)", - "descriptionFr": "Suite, 1 très grand lit (Services)", - "type": "Suite", - "baseRate": 2.44, - "bedOptions": "1 King Bed", - "sleepsCount": 2, - "smokingAllowed": true, - "tags": [ - "coffee maker" - ] - }, - { - "description": "Budget Room, 1 Queen Bed (Amenities)", - "descriptionFr": "Chambre Économique, 1 grand lit (Services)", - "type": "Budget Room", - "baseRate": 7.69, - "bedOptions": "1 Queen Bed", - "sleepsCount": 2, - "smokingAllowed": false, - "tags": [ - "coffee maker" - ] - } - ] - } -] diff --git a/sdk/search/azure-search-documents/samples/sample_agentic_retrieval.py b/sdk/search/azure-search-documents/samples/sample_agentic_retrieval.py new file mode 100644 index 000000000000..45177246e5a5 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/sample_agentic_retrieval.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates Knowledge Source and Knowledge Base CRUD operations and + a minimal retrieval query using a semantic intent. + +USAGE: + python sample_agentic_retrieval.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the admin key for your search service +""" + +import json +import os + +from azure.core.credentials import AzureKeyCredential +from azure.core.exceptions import ResourceNotFoundError +from azure.search.documents.indexes import SearchIndexClient +from azure.search.documents.knowledgebases import KnowledgeBaseRetrievalClient +from azure.search.documents.knowledgebases.models import ( + KnowledgeBaseRetrievalRequest, + KnowledgeRetrievalSemanticIntent, +) +from azure.search.documents.indexes.models import ( + KnowledgeBase, + KnowledgeSourceReference, + KnowledgeRetrievalMinimalReasoningEffort, + SearchIndexFieldReference, + SearchIndexKnowledgeSource, + SearchIndexKnowledgeSourceParameters, +) + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] + +knowledge_source_name = "hotels-sample-knowledge-source" +knowledge_base_name = "hotels-sample-knowledge-base" + + +def create_knowledge_source(): + # [START create_knowledge_source] + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + knowledge_source = SearchIndexKnowledgeSource( + name=knowledge_source_name, + search_index_parameters=SearchIndexKnowledgeSourceParameters( + search_index_name=index_name + ), + ) + + index_client.create_or_update_knowledge_source(knowledge_source=knowledge_source) + print(f"Created: knowledge source '{knowledge_source_name}'") + # [END create_knowledge_source] + + +def get_knowledge_source(): + # [START get_knowledge_source] + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + knowledge_source = index_client.get_knowledge_source(knowledge_source_name) + print(f"Retrieved: knowledge source '{knowledge_source.name}'") + # [END get_knowledge_source] + + +def update_knowledge_source(): + # [START update_knowledge_source] + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + knowledge_source = SearchIndexKnowledgeSource( + name=knowledge_source_name, + search_index_parameters=SearchIndexKnowledgeSourceParameters( + search_index_name=index_name, + source_data_fields=[ + SearchIndexFieldReference(name="HotelId"), + SearchIndexFieldReference(name="HotelName"), + SearchIndexFieldReference(name="Description"), + SearchIndexFieldReference(name="Category"), + SearchIndexFieldReference(name="Tags"), + ], + ), + ) + + index_client.create_or_update_knowledge_source(knowledge_source=knowledge_source) + print(f"Updated: knowledge source '{knowledge_source_name}'") + # [END update_knowledge_source] + + +def delete_knowledge_source(): + # [START delete_knowledge_source] + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + try: + index_client.delete_knowledge_source(knowledge_source_name) + print(f"Deleted: knowledge source '{knowledge_source_name}'") + except ResourceNotFoundError: + print(f"Skipped: knowledge source '{knowledge_source_name}' not found") + # [END delete_knowledge_source] + + +def create_knowledge_base(): + # [START create_knowledge_base] + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + knowledge_base = KnowledgeBase( + name=knowledge_base_name, + knowledge_sources=[KnowledgeSourceReference(name=knowledge_source_name)], + ) + + index_client.create_or_update_knowledge_base(knowledge_base) + print(f"Created: knowledge base '{knowledge_base_name}'") + # [END create_knowledge_base] + + +def get_knowledge_base(): + # [START get_knowledge_base] + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + knowledge_base = index_client.get_knowledge_base(knowledge_base_name) + print(f"Retrieved: knowledge base '{knowledge_base.name}'") + # [END get_knowledge_base] + + +def update_knowledge_base(): + # [START update_knowledge_base] + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + knowledge_base = KnowledgeBase( + name=knowledge_base_name, + knowledge_sources=[KnowledgeSourceReference(name=knowledge_source_name)], + retrieval_reasoning_effort=KnowledgeRetrievalMinimalReasoningEffort(), + ) + + index_client.create_or_update_knowledge_base(knowledge_base) + print(f"Updated: knowledge base '{knowledge_base_name}'") + # [END update_knowledge_base] + + +def retrieve_knowledge_base(): + # [START retrieve_knowledge_base] + retrieval_client = KnowledgeBaseRetrievalClient( + service_endpoint, + knowledge_base_name=knowledge_base_name, + credential=AzureKeyCredential(key), + ) + + request = KnowledgeBaseRetrievalRequest( + intents=[KnowledgeRetrievalSemanticIntent(search="hotels with free wifi")] + ) + + result = retrieval_client.retrieve(request) + print("Results: knowledge base retrieval") + + response_parts = [] + for resp in result.response or []: + for content in resp.content or []: + if hasattr(content, "text"): + response_parts.append(content.text) + + if response_parts: + response_content = "\n\n".join(response_parts) + + items = json.loads(response_content) + for i, item in enumerate(items[:5], start=1): + print(f" Result {i}:") + print(f" Title: {item.get('title')}") + print(f" Content: {item.get('content')}") + else: + print("Results: none") + # [END retrieve_knowledge_base] + + +def delete_knowledge_base(): + # [START delete_knowledge_base] + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + try: + index_client.delete_knowledge_base(knowledge_base_name) + print(f"Deleted: knowledge base '{knowledge_base_name}'") + except ResourceNotFoundError: + print(f"Skipped: knowledge base '{knowledge_base_name}' not found") + # [END delete_knowledge_base] + + +if __name__ == "__main__": + create_knowledge_source() + get_knowledge_source() + update_knowledge_source() + create_knowledge_base() + get_knowledge_base() + update_knowledge_base() + retrieve_knowledge_base() + delete_knowledge_base() + delete_knowledge_source() diff --git a/sdk/search/azure-search-documents/samples/sample_analyze_text.py b/sdk/search/azure-search-documents/samples/sample_analyze_text.py deleted file mode 100644 index 3a239870ea17..000000000000 --- a/sdk/search/azure-search-documents/samples/sample_analyze_text.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_analyze_text.py -DESCRIPTION: - This sample demonstrates how to analyze text. -USAGE: - python sample_analyze_text.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import os - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] -key = os.environ["AZURE_SEARCH_API_KEY"] - - -def simple_analyze_text(): - # [START simple_analyze_text] - from azure.core.credentials import AzureKeyCredential - from azure.search.documents.indexes import SearchIndexClient - from azure.search.documents.indexes.models import AnalyzeTextOptions - - client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - - analyze_request = AnalyzeTextOptions(text="One's ", analyzer_name="standard.lucene") - - result = client.analyze_text(index_name, analyze_request) - print(result.as_dict()) - # [END simple_analyze_text] - - -if __name__ == "__main__": - simple_analyze_text() diff --git a/sdk/search/azure-search-documents/samples/sample_authentication.py b/sdk/search/azure-search-documents/samples/sample_authentication.py index f690c7ff7e17..90a29836d859 100644 --- a/sdk/search/azure-search-documents/samples/sample_authentication.py +++ b/sdk/search/azure-search-documents/samples/sample_authentication.py @@ -1,31 +1,29 @@ # coding: utf-8 # ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. # -------------------------------------------------------------------------- """ -FILE: sample_authentication.py DESCRIPTION: - This sample demonstrates how to authenticate with the Azure Congnitive Search - service with an API key. See more details about authentication here: - https://learn.microsoft.com/azure.search.documents/search-security-api-keys + Demonstrates how to authenticate with the Azure AI Search service. + USAGE: python sample_authentication.py - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the admin key for your search service """ import os -def authentication_with_api_key_credential(): - # [START create_search_client_with_key] +def authenticate_search_client_with_api_key(): + # [START authenticate_search_client_with_api_key] from azure.core.credentials import AzureKeyCredential from azure.search.documents import SearchClient @@ -34,27 +32,31 @@ def authentication_with_api_key_credential(): key = os.environ["AZURE_SEARCH_API_KEY"] search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) - # [END create_search_client_with_key] + # [END authenticate_search_client_with_api_key] - result = search_client.get_document_count() + document_count = search_client.get_document_count() - print("There are {} documents in the {} search index.".format(result, index_name)) + print(f"Document count: {document_count} (index '{index_name}')") -def authentication_service_client_with_api_key_credential(): - # [START create_search_service_client_with_key] +def authenticate_index_client_with_api_key(): + # [START authenticate_index_client_with_api_key] from azure.core.credentials import AzureKeyCredential from azure.search.documents.indexes import SearchIndexClient service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] key = os.environ["AZURE_SEARCH_API_KEY"] - search_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - # [END create_search_service_client_with_key] + search_index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + # [END authenticate_index_client_with_api_key] + + result = search_index_client.list_indexes() + names = [x.name for x in result] + print(f"Indexes ({len(names)}): {', '.join(names)}") -def authentication_with_aad(): - # [START authentication_with_aad] +def authenticate_search_client_with_aad(): + # [START authenticate_search_client_with_aad] from azure.identity import DefaultAzureCredential from azure.search.documents import SearchClient @@ -63,27 +65,31 @@ def authentication_with_aad(): credential = DefaultAzureCredential() search_client = SearchClient(service_endpoint, index_name, credential) - # [END authentication_with_aad] + # [END authenticate_search_client_with_aad] - result = search_client.get_document_count() + document_count = search_client.get_document_count() - print("There are {} documents in the {} search index.".format(result, index_name)) + print(f"Document count: {document_count} (index '{index_name}')") -def authentication_service_client_with_aad(): - # [START authentication_service_client_with_aad] +def authenticate_index_client_with_aad(): + # [START authenticate_index_client_with_aad] from azure.identity import DefaultAzureCredential from azure.search.documents.indexes import SearchIndexClient service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] credential = DefaultAzureCredential() - search_client = SearchIndexClient(service_endpoint, credential) - # [END authentication_service_client_with_aad] + search_index_client = SearchIndexClient(service_endpoint, credential) + # [END authenticate_index_client_with_aad] + + result = search_index_client.list_indexes() + names = [x.name for x in result] + print(f"Indexes ({len(names)}): {', '.join(names)}") if __name__ == "__main__": - authentication_with_api_key_credential() - authentication_service_client_with_api_key_credential() - authentication_with_aad() - authentication_service_client_with_aad() + authenticate_search_client_with_api_key() + authenticate_index_client_with_api_key() + authenticate_search_client_with_aad() + authenticate_index_client_with_aad() diff --git a/sdk/search/azure-search-documents/samples/sample_buffered_sender.py b/sdk/search/azure-search-documents/samples/sample_buffered_sender.py deleted file mode 100644 index db7de92154a2..000000000000 --- a/sdk/search/azure-search-documents/samples/sample_buffered_sender.py +++ /dev/null @@ -1,51 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_batch_client.py -DESCRIPTION: - This sample demonstrates how to upload, merge, or delete documents using SearchIndexingBufferedSender. -USAGE: - python sample_batch_client.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import os - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] -key = os.environ["AZURE_SEARCH_API_KEY"] - -from azure.core.credentials import AzureKeyCredential -from azure.search.documents import SearchIndexingBufferedSender - - -def sample_batching_client(): - DOCUMENT = { - "category": "Hotel", - "hotelId": "1000", - "rating": 4.0, - "rooms": [], - "hotelName": "Azure Inn", - } - - with SearchIndexingBufferedSender(service_endpoint, index_name, AzureKeyCredential(key)) as batch_client: - # add upload actions - batch_client.upload_documents(documents=[DOCUMENT]) - # add merge actions - batch_client.merge_documents(documents=[{"hotelId": "1000", "rating": 4.5}]) - # add delete actions - batch_client.delete_documents(documents=[{"hotelId": "1000"}]) - - -if __name__ == "__main__": - sample_batching_client() diff --git a/sdk/search/azure-search-documents/samples/sample_crud_operations.py b/sdk/search/azure-search-documents/samples/sample_crud_operations.py deleted file mode 100644 index de22c6b5cb82..000000000000 --- a/sdk/search/azure-search-documents/samples/sample_crud_operations.py +++ /dev/null @@ -1,67 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_crud_operations.py -DESCRIPTION: - This sample demonstrates how to upload, merge, or delete documents from an - Azure Search index. -USAGE: - python sample_crud_operations.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import os - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] -key = os.environ["AZURE_SEARCH_API_KEY"] - -from azure.core.credentials import AzureKeyCredential -from azure.search.documents import SearchClient - -search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) - - -def upload_document(): - # [START upload_document] - DOCUMENT = { - "hotelId": "1000", - "hotelName": "Azure Inn", - } - - result = search_client.upload_documents(documents=[DOCUMENT]) - - print("Upload of new document succeeded: {}".format(result[0].succeeded)) - # [END upload_document] - - -def merge_document(): - # [START merge_document] - result = search_client.merge_documents(documents=[{"hotelId": "783", "hotelName": "Renovated Ranch"}]) - - print("Merge into new document succeeded: {}".format(result[0].succeeded)) - # [END merge_document] - - -def delete_document(): - # [START delete_document] - result = search_client.delete_documents(documents=[{"hotelId": "1000"}]) - - print("Delete new document succeeded: {}".format(result[0].succeeded)) - # [END delete_document] - - -if __name__ == "__main__": - upload_document() - merge_document() - delete_document() diff --git a/sdk/search/azure-search-documents/samples/sample_data_source_operations.py b/sdk/search/azure-search-documents/samples/sample_data_source_operations.py deleted file mode 100644 index cf14b3fa25cf..000000000000 --- a/sdk/search/azure-search-documents/samples/sample_data_source_operations.py +++ /dev/null @@ -1,72 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_data_source_operations.py -DESCRIPTION: - This sample demonstrates how to get, create, update, or delete a Data Source. -USAGE: - python sample_data_source_operations.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_API_KEY - your search API key -""" - -import os - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -key = os.environ["AZURE_SEARCH_API_KEY"] -connection_string = os.environ["AZURE_STORAGE_CONNECTION_STRING"] - -from azure.core.credentials import AzureKeyCredential -from azure.search.documents.indexes import SearchIndexerClient -from azure.search.documents.indexes.models import SearchIndexerDataContainer, SearchIndexerDataSourceConnection - -client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) - - -def create_data_source_connection(): - # [START create_data_source_connection] - container = SearchIndexerDataContainer(name="searchcontainer") - data_source_connection = SearchIndexerDataSourceConnection( - name="sample-data-source-connection", type="azureblob", connection_string=connection_string, container=container - ) - result = client.create_data_source_connection(data_source_connection) - print(result) - print("Create new Data Source Connection - sample-data-source-connection") - # [END create_data_source_connection] - - -def list_data_source_connections(): - # [START list_data_source_connection] - result = client.get_data_source_connections() - names = [ds.name for ds in result] - print("Found {} Data Source Connections in the service: {}".format(len(result), ", ".join(names))) - # [END list_data_source_connection] - - -def get_data_source_connection(): - # [START get_data_source_connection] - result = client.get_data_source_connection("sample-data-source-connection") - print("Retrived Data Source Connection 'sample-data-source-connection'") - # [END get_data_source_connection] - - -def delete_data_source_connection(): - # [START delete_data_source_connection] - client.delete_data_source_connection("sample-data-source-connection") - print("Data Source Connection 'sample-data-source-connection' successfully deleted") - # [END delete_data_source_connection] - - -if __name__ == "__main__": - create_data_source_connection() - list_data_source_connections() - get_data_source_connection() - delete_data_source_connection() diff --git a/sdk/search/azure-search-documents/samples/sample_documents_buffered_sender.py b/sdk/search/azure-search-documents/samples/sample_documents_buffered_sender.py new file mode 100644 index 000000000000..f514de4b2837 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/sample_documents_buffered_sender.py @@ -0,0 +1,73 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to use the SearchIndexingBufferedSender for high-throughput indexing. + +USAGE: + python sample_documents_buffered_sender.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the admin key for your search service +""" + +import os + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] + + +def sample_batching_client(): + # [START sample_batching_client] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents import SearchIndexingBufferedSender + + document = { + "HotelId": "100", + "HotelName": "Azure Sanctuary", + "Description": "A quiet retreat offering understated elegance and premium amenities.", + "Description_fr": "Meilleur hôtel en ville si vous aimez les hôtels de luxe.", + "Category": "Luxury", + "Tags": [ + "pool", + "view", + "wifi", + "concierge", + "private beach", + "gourmet dining", + "spa", + ], + "ParkingIncluded": False, + "LastRenovationDate": "2024-01-15T00:00:00+00:00", + "Rating": 5, + "Location": {"type": "Point", "coordinates": [-122.131577, 47.678581]}, + } + + with SearchIndexingBufferedSender( + service_endpoint, index_name, AzureKeyCredential(key) + ) as buffered_sender: + # add upload actions + buffered_sender.upload_documents(documents=[document]) + print(f"Uploaded: document {document['HotelId']}") + + # add merge actions + buffered_sender.merge_documents(documents=[{"HotelId": "100", "Rating": 4.5}]) + print(f"Merged: document {document['HotelId']}") + + # add delete actions + buffered_sender.delete_documents(documents=[{"HotelId": "100"}]) + print(f"Deleted: document {document['HotelId']}") + # [END sample_batching_client] + + +if __name__ == "__main__": + sample_batching_client() diff --git a/sdk/search/azure-search-documents/samples/sample_documents_crud.py b/sdk/search/azure-search-documents/samples/sample_documents_crud.py new file mode 100644 index 000000000000..2b7fe2ce17c7 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/sample_documents_crud.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to upload, merge, get, and delete documents. + +USAGE: + python sample_documents_crud.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the admin key for your search service +""" + +import os + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] + + +def upload_document(): + # [START upload_document] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents import SearchClient + + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + document = { + "HotelId": "100", + "HotelName": "Azure Sanctuary", + "Description": "A quiet retreat offering understated elegance and premium amenities.", + "Description_fr": "Meilleur hôtel en ville si vous aimez les hôtels de luxe.", + "Category": "Luxury", + "Tags": [ + "pool", + "view", + "wifi", + "concierge", + "private beach", + "gourmet dining", + "spa", + ], + "ParkingIncluded": False, + "LastRenovationDate": "2024-01-15T00:00:00+00:00", + "Rating": 5, + "Location": {"type": "Point", "coordinates": [-122.131577, 47.678581]}, + } + + result = search_client.upload_documents(documents=[document]) + + print(f"Uploaded: document 100 (succeeded={result[0].succeeded})") + # [END upload_document] + + +def merge_document(): + # [START merge_document] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents import SearchClient + + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + result = search_client.merge_documents( + documents=[{"HotelId": "100", "HotelName": "Azure Sanctuary & Spa"}] + ) + + print(f"Merged: document 100 (succeeded={result[0].succeeded})") + # [END merge_document] + + +def get_document(): + # [START get_document] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents import SearchClient + + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + result = search_client.get_document(key="100") + + print("Result:") + print(f" HotelId: 100") + print(f" HotelName: {result['HotelName']}") + # [END get_document] + + +def delete_document(): + # [START delete_document] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents import SearchClient + + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + result = search_client.delete_documents(documents=[{"HotelId": "100"}]) + + print(f"Deleted: document 100 (succeeded={result[0].succeeded})") + # [END delete_document] + + +if __name__ == "__main__": + upload_document() + merge_document() + get_document() + delete_document() diff --git a/sdk/search/azure-search-documents/samples/sample_facet_query.py b/sdk/search/azure-search-documents/samples/sample_facet_query.py deleted file mode 100644 index a70078173d11..000000000000 --- a/sdk/search/azure-search-documents/samples/sample_facet_query.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_facet_query.py -DESCRIPTION: - This sample demonstrates how to obtain search facets on specified field in - an Azure Search index. -USAGE: - python sample_facet_query.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -from typing import List, Dict, cast -import os - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] -key = os.environ["AZURE_SEARCH_API_KEY"] - - -def filter_query(): - # [START facet_query] - from azure.core.credentials import AzureKeyCredential - from azure.search.documents import SearchClient - - search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) - - results = search_client.search(search_text="WiFi", facets=["category,count:3", "parkingIncluded"]) - - facets: Dict[str, List[str]] = cast(Dict[str, List[str]], results.get_facets()) - - print("Catgory facet counts for hotels:") - for facet in facets["category"]: - print(" {}".format(facet)) - # [END facet_query] - - -if __name__ == "__main__": - filter_query() diff --git a/sdk/search/azure-search-documents/samples/sample_filter_query.py b/sdk/search/azure-search-documents/samples/sample_filter_query.py deleted file mode 100644 index 432edf9a1f02..000000000000 --- a/sdk/search/azure-search-documents/samples/sample_filter_query.py +++ /dev/null @@ -1,51 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_filter_query.py -DESCRIPTION: - This sample demonstrates how search results from an Azure Search index can - be filtered and ordered. -USAGE: - python sample_filter_query.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import os - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] -key = os.environ["AZURE_SEARCH_API_KEY"] - - -def filter_query(): - # [START filter_query] - from azure.core.credentials import AzureKeyCredential - from azure.search.documents import SearchClient - - search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) - - results = search_client.search( - search_text="WiFi", - filter="Address/StateProvince eq 'FL' and Address/Country eq 'USA'", - select=["hotelName", "rating"], - order_by=["rating desc"], - ) - - print("Florida hotels containing 'WiFi', sorted by Rating:") - for result in results: - print(" Name: {} (rating {})".format(result["hotelName"], result["rating"])) - # [END filter_query] - - -if __name__ == "__main__": - filter_query() diff --git a/sdk/search/azure-search-documents/samples/sample_get_document.py b/sdk/search/azure-search-documents/samples/sample_get_document.py deleted file mode 100644 index 0a5addfa14cb..000000000000 --- a/sdk/search/azure-search-documents/samples/sample_get_document.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_get_document.py -DESCRIPTION: - This sample demonstrates how to retrieve a specific document by key from an - Azure Search index. -USAGE: - python sample_get_document.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import os - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] -key = os.environ["AZURE_SEARCH_API_KEY"] - - -def get_document(): - # [START get_document] - from azure.core.credentials import AzureKeyCredential - from azure.search.documents import SearchClient - - search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) - - result = search_client.get_document(key="23") - - print("Details for hotel '23' are:") - print(" Name: {}".format(result["hotelName"])) - # [END get_document] - - -if __name__ == "__main__": - get_document() diff --git a/sdk/search/azure-search-documents/samples/sample_index_alias_crud.py b/sdk/search/azure-search-documents/samples/sample_index_alias_crud.py new file mode 100644 index 000000000000..4851509a2523 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/sample_index_alias_crud.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to create, get, update, and delete an index alias. + +USAGE: + python sample_index_alias_crud.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_API_KEY - the admin key for your search service + 3) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") +""" + + +import os + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] +alias_name = "hotel-alias" +new_index_name = "hotels-sample-index-v2" + + +def create_alias(): + # [START create_alias] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexClient + from azure.search.documents.indexes.models import SearchAlias + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + alias = SearchAlias(name=alias_name, indexes=[index_name]) + result = index_client.create_alias(alias) + print(f"Created: alias '{result.name}' -> index '{index_name}'") + # [END create_alias] + + +def get_alias(): + # [START get_alias] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexClient + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + result = index_client.get_alias(alias_name) + print(f"Retrieved: alias '{result.name}'") + # [END get_alias] + + +def update_alias(): + # [START update_alias] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexClient + from azure.search.documents.indexes.models import ( + ComplexField, + CorsOptions, + ScoringProfile, + SearchAlias, + SearchIndex, + SimpleField, + SearchableField, + SearchFieldDataType, + ) + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + # Create a new index with a different schema or settings + # In a real scenario, this would be your updated index version (e.g., v2) + fields = [ + SimpleField(name="HotelId", type=SearchFieldDataType.String, key=True), + SimpleField(name="BaseRate", type=SearchFieldDataType.Double), + SearchableField( + name="Description", type=SearchFieldDataType.String, collection=True + ), + SearchableField(name="HotelName", type=SearchFieldDataType.String), + ComplexField( + name="Address", + fields=[ + SimpleField(name="StreetAddress", type=SearchFieldDataType.String), + SimpleField(name="City", type=SearchFieldDataType.String), + SimpleField(name="State", type=SearchFieldDataType.String), + ], + collection=True, + ), + ] + cors_options = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60) + scoring_profile = ScoringProfile(name="MyProfile") + index = SearchIndex( + name=new_index_name, + fields=fields, + scoring_profiles=[scoring_profile], + cors_options=cors_options, + ) + + index_client.create_or_update_index(index=index) + print(f"Created: index '{new_index_name}'") + + # Update the alias to point to the new index + # This operation is atomic and ensures zero downtime for applications using the alias + alias = SearchAlias(name=alias_name, indexes=[new_index_name]) + result = index_client.create_or_update_alias(alias) + print(f"Updated: alias '{result.name}' -> index '{new_index_name}'") + # [END update_alias] + + +def delete_alias(): + # [START delete_alias] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexClient + from azure.core.exceptions import ResourceNotFoundError + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + index_client.delete_alias(alias_name) + print(f"Deleted: alias '{alias_name}'") + + try: + index_client.delete_index(new_index_name) + print(f"Deleted: index '{new_index_name}'") + except ResourceNotFoundError: + print(f"Skipped: index '{new_index_name}' not found") + # [END delete_alias] + + +if __name__ == "__main__": + create_alias() + get_alias() + update_alias() + delete_alias() diff --git a/sdk/search/azure-search-documents/samples/sample_index_alias_crud_operations.py b/sdk/search/azure-search-documents/samples/sample_index_alias_crud_operations.py deleted file mode 100644 index 52220f12b8e4..000000000000 --- a/sdk/search/azure-search-documents/samples/sample_index_alias_crud_operations.py +++ /dev/null @@ -1,105 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_index_alias_crud_operations.py -DESCRIPTION: - This sample demonstrates how to get, create, update, or delete an alias with an existing index. -USAGE: - python sample_index_alias_crud_operations.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_API_KEY - your search API key - 3) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") -""" - - -import os - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] -key = os.environ["AZURE_SEARCH_API_KEY"] -alias_name = "motels" - -from azure.core.credentials import AzureKeyCredential -from azure.search.documents.indexes import SearchIndexClient -from azure.search.documents.indexes.models import ( - ComplexField, - CorsOptions, - ScoringProfile, - SearchAlias, - SearchIndex, - SimpleField, - SearchableField, - SearchFieldDataType, -) - - -client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - - -def create_alias(): - # [START create_alias] - alias = SearchAlias(name=alias_name, indexes=[index_name]) - result = client.create_alias(alias) - # [END create_alias] - - -def get_alias(): - # [START get_alias] - result = client.get_alias(alias_name) - # [END get_alias] - - -def update_alias(): - # [START update_alias] - new_index_name = "hotels" - fields = [ - SimpleField(name="hotelId", type=SearchFieldDataType.String, key=True), - SimpleField(name="baseRate", type=SearchFieldDataType.Double), - SearchableField(name="description", type=SearchFieldDataType.String, collection=True), - SearchableField(name="hotelName", type=SearchFieldDataType.String), - ComplexField( - name="address", - fields=[ - SimpleField(name="streetAddress", type=SearchFieldDataType.String), - SimpleField(name="city", type=SearchFieldDataType.String), - SimpleField(name="state", type=SearchFieldDataType.String), - ], - collection=True, - ), - ] - cors_options = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60) - scoring_profile = ScoringProfile(name="MyProfile") - scoring_profiles = [] - scoring_profiles.append(scoring_profile) - index = SearchIndex( - name=new_index_name, fields=fields, scoring_profiles=scoring_profiles, cors_options=cors_options - ) - - result_index = client.create_or_update_index(index=index) - - alias = SearchAlias(name=alias_name, indexes=[new_index_name]) - result = client.create_or_update_alias(alias) - - # [END update_alias] - - -def delete_alias(): - # [START delete_alias] - - client.delete_alias(alias_name) - # [END delete_alias] - - -if __name__ == "__main__": - create_alias() - get_alias() - update_alias() - delete_alias() diff --git a/sdk/search/azure-search-documents/samples/sample_index_analyze_text.py b/sdk/search/azure-search-documents/samples/sample_index_analyze_text.py new file mode 100644 index 000000000000..ff5fd6d0110c --- /dev/null +++ b/sdk/search/azure-search-documents/samples/sample_index_analyze_text.py @@ -0,0 +1,52 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to analyze text using a specific analyzer. + +USAGE: + python sample_index_analyze_text.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the admin key for your search service +""" + +import os + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] + + +def simple_analyze_text(): + # [START simple_analyze_text] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexClient + from azure.search.documents.indexes.models import AnalyzeTextOptions + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + analyze_request = AnalyzeTextOptions( + text="One's ", analyzer_name="standard.lucene" + ) + + analysis_result = index_client.analyze_text(index_name, analyze_request) + + print("Results:") + for token in analysis_result.tokens: + print( + f" Token: {token.token}, Start: {token.start_offset}, End: {token.end_offset}" + ) + # [END simple_analyze_text] + + +if __name__ == "__main__": + simple_analyze_text() diff --git a/sdk/search/azure-search-documents/samples/sample_index_client_custom_request.py b/sdk/search/azure-search-documents/samples/sample_index_client_custom_request.py new file mode 100644 index 000000000000..636e8f0ba2d1 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/sample_index_client_custom_request.py @@ -0,0 +1,51 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to make custom HTTP requests using SearchIndexClient. + +USAGE: + python sample_index_client_custom_request.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the admin key for your search service +""" + + +def sample_send_request(): + # [START sample_send_request] + import os + from azure.core.credentials import AzureKeyCredential + from azure.core.rest import HttpRequest + from azure.search.documents.indexes import SearchIndexClient + from sample_utils import AZURE_SEARCH_API_VERSION + + endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] + index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] + key = os.environ["AZURE_SEARCH_API_KEY"] + + index_client = SearchIndexClient(endpoint, AzureKeyCredential(key)) + + # The `send_request` method can send custom HTTP requests that share the client's existing pipeline, + # while adding convenience for endpoint construction. + request = HttpRequest( + method="GET", + url=f"/indexes('{index_name}')?api-version={AZURE_SEARCH_API_VERSION}", + ) + response = index_client.send_request(request) + response.raise_for_status() + response_body = response.json() + print(f"Response: {response_body}") + # [END sample_send_request] + + +if __name__ == "__main__": + sample_send_request() diff --git a/sdk/search/azure-search-documents/samples/sample_index_client_send_request.py b/sdk/search/azure-search-documents/samples/sample_index_client_send_request.py deleted file mode 100644 index f8b373b1970b..000000000000 --- a/sdk/search/azure-search-documents/samples/sample_index_client_send_request.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_index_client_send_request.py - -DESCRIPTION: - This sample demonstrates how to make custom HTTP requests through a client pipeline. - -USAGE: - python sample_index_client_send_request.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import os -from azure.core.credentials import AzureKeyCredential -from azure.core.rest import HttpRequest -from azure.search.documents.indexes import SearchIndexClient - - -def sample_send_request(): - endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] - index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] - key = os.environ["AZURE_SEARCH_API_KEY"] - - client = SearchIndexClient(endpoint, AzureKeyCredential(key)) - - # The `send_request` method can send custom HTTP requests that share the client's existing pipeline, - # while adding convenience for endpoint construction. - request = HttpRequest(method="GET", url=f"/indexes('{index_name}')?api-version=2024-05-01-preview") - response = client.send_request(request) - response.raise_for_status() - response_body = response.json() - print(response_body) - - -if __name__ == "__main__": - sample_send_request() diff --git a/sdk/search/azure-search-documents/samples/sample_index_crud.py b/sdk/search/azure-search-documents/samples/sample_index_crud.py new file mode 100644 index 000000000000..6d0b13aad31a --- /dev/null +++ b/sdk/search/azure-search-documents/samples/sample_index_crud.py @@ -0,0 +1,149 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to create, get, update, and delete a search index. + +USAGE: + python sample_index_crud.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_API_KEY - the admin key for your search service +""" + + +import os +from typing import List + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +key = os.environ["AZURE_SEARCH_API_KEY"] +index_name = "hotels-sample-index-index-crud" + + +def create_index(): + # [START create_index] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexClient + from azure.search.documents.indexes.models import ( + ComplexField, + CorsOptions, + SearchIndex, + ScoringProfile, + SearchFieldDataType, + SimpleField, + SearchableField, + ) + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + fields = [ + SimpleField(name="HotelId", type=SearchFieldDataType.String, key=True), + SimpleField(name="HotelName", type=SearchFieldDataType.String, searchable=True), + SimpleField(name="BaseRate", type=SearchFieldDataType.Double), + SearchableField( + name="Description", type=SearchFieldDataType.String, collection=True + ), + ComplexField( + name="Address", + fields=[ + SimpleField(name="StreetAddress", type=SearchFieldDataType.String), + SimpleField(name="City", type=SearchFieldDataType.String), + ], + collection=True, + ), + ] + cors_options = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60) + scoring_profiles: List[ScoringProfile] = [] + index = SearchIndex( + name=index_name, + fields=fields, + scoring_profiles=scoring_profiles, + cors_options=cors_options, + ) + + result = index_client.create_index(index) + print(f"Created: index '{result.name}'") + # [END create_index] + + +def get_index(): + # [START get_index] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexClient + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + result = index_client.get_index(index_name) + print(f"Retrieved: index '{result.name}'") + # [END get_index] + + +def update_index(): + # [START update_index] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexClient + from azure.search.documents.indexes.models import ( + ComplexField, + CorsOptions, + SearchIndex, + ScoringProfile, + SearchFieldDataType, + SimpleField, + SearchableField, + ) + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + fields = [ + SimpleField(name="HotelId", type=SearchFieldDataType.String, key=True), + SimpleField(name="HotelName", type=SearchFieldDataType.String, searchable=True), + SimpleField(name="BaseRate", type=SearchFieldDataType.Double), + SearchableField( + name="Description", type=SearchFieldDataType.String, collection=True + ), + ComplexField( + name="Address", + fields=[ + SimpleField(name="StreetAddress", type=SearchFieldDataType.String), + SimpleField(name="City", type=SearchFieldDataType.String), + SimpleField(name="State", type=SearchFieldDataType.String), + ], + collection=True, + ), + ] + cors_options = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60) + scoring_profile = ScoringProfile(name="MyProfile") + scoring_profiles = [] + scoring_profiles.append(scoring_profile) + index = SearchIndex( + name=index_name, + fields=fields, + scoring_profiles=scoring_profiles, + cors_options=cors_options, + ) + + result = index_client.create_or_update_index(index=index) + print(f"Updated: index '{result.name}'") + # [END update_index] + + +def delete_index(): + # [START delete_index] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexClient + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + index_client.delete_index(index_name) + print(f"Deleted: index '{index_name}'") + # [END delete_index] + + +if __name__ == "__main__": + create_index() + get_index() + update_index() + delete_index() diff --git a/sdk/search/azure-search-documents/samples/sample_index_crud_operations.py b/sdk/search/azure-search-documents/samples/sample_index_crud_operations.py deleted file mode 100644 index 6b0cabb2c2dd..000000000000 --- a/sdk/search/azure-search-documents/samples/sample_index_crud_operations.py +++ /dev/null @@ -1,116 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_index_crud_operations.py -DESCRIPTION: - This sample demonstrates how to get, create, update, or delete an index. -USAGE: - python sample_index_crud_operations.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_API_KEY - your search API key -""" - - -import os -from typing import List - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -key = os.environ["AZURE_SEARCH_API_KEY"] - -from azure.core.credentials import AzureKeyCredential -from azure.search.documents.indexes import SearchIndexClient -from azure.search.documents.indexes.models import ( - ComplexField, - CorsOptions, - SearchIndex, - ScoringProfile, - SearchFieldDataType, - SimpleField, - SearchableField, -) - - -def create_index(): - # [START create_index] - client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - name = "hotels" - fields = [ - SimpleField(name="hotelId", type=SearchFieldDataType.String, key=True), - SimpleField(name="hotelName", type=SearchFieldDataType.String, searchable=True), - SimpleField(name="baseRate", type=SearchFieldDataType.Double), - SearchableField(name="description", type=SearchFieldDataType.String, collection=True), - ComplexField( - name="address", - fields=[ - SimpleField(name="streetAddress", type=SearchFieldDataType.String), - SimpleField(name="city", type=SearchFieldDataType.String), - ], - collection=True, - ), - ] - cors_options = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60) - scoring_profiles: List[ScoringProfile] = [] - index = SearchIndex(name=name, fields=fields, scoring_profiles=scoring_profiles, cors_options=cors_options) - - result = client.create_index(index) - # [END create_index] - - -def get_index(): - # [START get_index] - client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - name = "hotels" - result = client.get_index(name) - # [END get_index] - - -def update_index(): - # [START update_index] - client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - name = "hotels" - fields = [ - SimpleField(name="hotelId", type=SearchFieldDataType.String, key=True), - SimpleField(name="hotelName", type=SearchFieldDataType.String, searchable=True), - SimpleField(name="baseRate", type=SearchFieldDataType.Double), - SearchableField(name="description", type=SearchFieldDataType.String, collection=True), - ComplexField( - name="address", - fields=[ - SimpleField(name="streetAddress", type=SearchFieldDataType.String), - SimpleField(name="city", type=SearchFieldDataType.String), - SimpleField(name="state", type=SearchFieldDataType.String), - ], - collection=True, - ), - ] - cors_options = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60) - scoring_profile = ScoringProfile(name="MyProfile") - scoring_profiles = [] - scoring_profiles.append(scoring_profile) - index = SearchIndex(name=name, fields=fields, scoring_profiles=scoring_profiles, cors_options=cors_options) - - result = client.create_or_update_index(index=index) - # [END update_index] - - -def delete_index(): - # [START delete_index] - client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - name = "hotels" - client.delete_index(name) - # [END delete_index] - - -if __name__ == "__main__": - create_index() - get_index() - update_index() - delete_index() diff --git a/sdk/search/azure-search-documents/samples/sample_index_synonym_map_crud.py b/sdk/search/azure-search-documents/samples/sample_index_synonym_map_crud.py new file mode 100644 index 000000000000..904ec0815c6c --- /dev/null +++ b/sdk/search/azure-search-documents/samples/sample_index_synonym_map_crud.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to create, get, update, and delete a synonym map. +USAGE: + python sample_index_synonym_map_crud.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + 2) AZURE_SEARCH_API_KEY - the primary admin key for your search service +""" + +import os +from pathlib import Path + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +key = os.environ["AZURE_SEARCH_API_KEY"] + +map1 = "hotels-sample-synonym-map" +map2 = "hotels-sample-synonym-map-file" +file_path = Path(__file__).resolve().parent / "data" / "synonym_map.txt" + + +def create_synonym_map(name): + # [START create_synonym_map] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexClient + from azure.search.documents.indexes.models import SynonymMap + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + synonyms = [ + "USA, United States, United States of America", + "Washington, Wash. => WA", + ] + synonym_map = SynonymMap(name=name, synonyms=synonyms) + result = index_client.create_synonym_map(synonym_map) + print(f"Created: synonym map '{result.name}'") + # [END create_synonym_map] + + +def create_synonym_map_from_file(name): + # [START create_synonym_map_from_file] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexClient + from azure.search.documents.indexes.models import SynonymMap + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + with open(file_path, "r") as f: + solr_format_synonyms = f.read() + synonyms = solr_format_synonyms.split("\n") + synonym_map = SynonymMap(name=name, synonyms=synonyms) + result = index_client.create_synonym_map(synonym_map) + print(f"Created: synonym map '{result.name}'") + # [END create_synonym_map_from_file] + + +def get_synonym_maps(): + # [START get_synonym_maps] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexClient + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + result = index_client.get_synonym_maps() + names = [x.name for x in result] + print(f"Synonym maps ({len(result)}): {', '.join(names)}") + # [END get_synonym_maps] + + +def get_synonym_map(name): + # [START get_synonym_map] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexClient + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + result = index_client.get_synonym_map(name) + print(f"Retrieved: synonym map '{name}'") + if result: + for syn in result.synonyms: + print(f" {syn}") + # [END get_synonym_map] + + +def delete_synonym_map(name): + # [START delete_synonym_map] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexClient + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + index_client.delete_synonym_map(name) + print(f"Deleted: synonym map '{name}'") + # [END delete_synonym_map] + + +if __name__ == "__main__": + create_synonym_map(map1) + create_synonym_map_from_file(map2) + get_synonym_maps() + get_synonym_map(map1) + delete_synonym_map(map1) + delete_synonym_map(map2) diff --git a/sdk/search/azure-search-documents/samples/sample_indexer_crud.py b/sdk/search/azure-search-documents/samples/sample_indexer_crud.py new file mode 100644 index 000000000000..33741a9be30e --- /dev/null +++ b/sdk/search/azure-search-documents/samples/sample_indexer_crud.py @@ -0,0 +1,179 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to create, get, update, and delete an indexer. + +USAGE: + python sample_indexer_crud.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_API_KEY - the admin key for your search service + 3) AZURE_STORAGE_CONNECTION_STRING - connection string for the Azure Storage account +""" + +import os + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +key = os.environ["AZURE_SEARCH_API_KEY"] +connection_string = os.environ["AZURE_STORAGE_CONNECTION_STRING"] +container_name = "hotels-sample-container" +index_name = "hotels-sample-index-indexer-crud" +data_source_name = "hotels-sample-blob" +indexer_name = "hotels-sample-indexer-indexer-crud" + + +def create_indexer(): + # [START create_indexer] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexClient, SearchIndexerClient + from azure.search.documents.indexes.models import ( + SearchIndexerDataContainer, + SearchIndexerDataSourceConnection, + SearchIndex, + SearchIndexer, + SimpleField, + SearchFieldDataType, + ) + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + # create an index + fields = [ + SimpleField(name="HotelId", type=SearchFieldDataType.String, key=True), + SimpleField(name="BaseRate", type=SearchFieldDataType.Double), + ] + index = SearchIndex(name=index_name, fields=fields) + index_client.create_index(index) + + # create a datasource + container = SearchIndexerDataContainer(name=container_name) + data_source_connection = SearchIndexerDataSourceConnection( + name=data_source_name, + type="azureblob", + connection_string=connection_string, + container=container, + ) + indexer_client.create_data_source_connection(data_source_connection) + + # create an indexer + indexer = SearchIndexer( + name=indexer_name, + data_source_name=data_source_name, + target_index_name=index_name, + ) + result = indexer_client.create_indexer(indexer) + print(f"Created: indexer '{result.name}'") + # [END create_indexer] + + +def list_indexers(): + # [START list_indexers] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexerClient + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + + result = indexer_client.get_indexers() + names = [x.name for x in result] + print(f"Indexers ({len(result)}): {', '.join(names)}") + # [END list_indexers] + + +def get_indexer(): + # [START get_indexer] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexerClient + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + + result = indexer_client.get_indexer(indexer_name) + print(f"Retrieved: indexer '{result.name}'") + return result + # [END get_indexer] + + +def get_indexer_status(): + # [START get_indexer_status] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexerClient + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + + status = indexer_client.get_indexer_status(indexer_name) + print(f"Status: indexer '{indexer_name}' is {status.status}") + return status + # [END get_indexer_status] + + +def run_indexer(): + # [START run_indexer] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexerClient + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + + indexer_client.run_indexer(indexer_name) + print(f"Ran: indexer '{indexer_name}'") + # [END run_indexer] + + +def reset_indexer(): + # [START reset_indexer] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexerClient + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + result = indexer_client.reset_indexer(indexer_name) + print(f"Reset: indexer '{indexer_name}'") + return result + # [END reset_indexer] + + +def delete_indexer(): + # [START delete_indexer] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexerClient + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + indexer_client.delete_indexer(indexer_name) + print(f"Deleted: indexer '{indexer_name}'") + # [END delete_indexer] + + +def delete_data_source(): + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexerClient + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + indexer_client.delete_data_source_connection(data_source_name) + print(f"Deleted: data source '{data_source_name}'") + + +def delete_index(): + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexClient + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + index_client.delete_index(index_name) + print(f"Deleted: index '{index_name}'") + + +if __name__ == "__main__": + create_indexer() + list_indexers() + get_indexer() + get_indexer_status() + run_indexer() + reset_indexer() + delete_indexer() + delete_data_source() + delete_index() diff --git a/sdk/search/azure-search-documents/samples/sample_indexer_datasource_crud.py b/sdk/search/azure-search-documents/samples/sample_indexer_datasource_crud.py new file mode 100644 index 000000000000..b110043daee9 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/sample_indexer_datasource_crud.py @@ -0,0 +1,96 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to create, get, update, and delete a data source. + +USAGE: + python sample_indexer_datasource_crud.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_API_KEY - the admin key for your search service + 3) AZURE_STORAGE_CONNECTION_STRING - connection string for the Azure Storage account +""" + +import os + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +key = os.environ["AZURE_SEARCH_API_KEY"] +connection_string = os.environ["AZURE_STORAGE_CONNECTION_STRING"] + +data_source_connection_name = "hotels-sample-blob" +container_name = "hotels-sample-container" + + +def create_data_source_connection(): + # [START create_data_source_connection] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexerClient + from azure.search.documents.indexes.models import ( + SearchIndexerDataContainer, + SearchIndexerDataSourceConnection, + ) + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + + container = SearchIndexerDataContainer(name=container_name) + data_source_connection = SearchIndexerDataSourceConnection( + name=data_source_connection_name, + type="azureblob", + connection_string=connection_string, + container=container, + ) + result = indexer_client.create_data_source_connection(data_source_connection) + print(f"Created: data source '{result.name}'") + # [END create_data_source_connection] + + +def list_data_source_connections(): + # [START list_data_source_connections] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexerClient + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + + result = indexer_client.get_data_source_connections() + names = [ds.name for ds in result] + print(f"Data sources ({len(result)}): {', '.join(names)}") + # [END list_data_source_connections] + + +def get_data_source_connection(): + # [START get_data_source_connection] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexerClient + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + + result = indexer_client.get_data_source_connection(data_source_connection_name) + print(f"Retrieved: data source '{result.name}'") + # [END get_data_source_connection] + + +def delete_data_source_connection(): + # [START delete_data_source_connection] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexerClient + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + + indexer_client.delete_data_source_connection(data_source_connection_name) + print(f"Deleted: data source '{data_source_connection_name}'") + # [END delete_data_source_connection] + + +if __name__ == "__main__": + create_data_source_connection() + list_data_source_connections() + get_data_source_connection() + delete_data_source_connection() diff --git a/sdk/search/azure-search-documents/samples/sample_indexer_datasource_skillset.py b/sdk/search/azure-search-documents/samples/sample_indexer_datasource_skillset.py deleted file mode 100644 index b0654e56210f..000000000000 --- a/sdk/search/azure-search-documents/samples/sample_indexer_datasource_skillset.py +++ /dev/null @@ -1,152 +0,0 @@ -""" -FILE: sample_indexer_datasource_skillset.py -DESCRIPTION: - This sample demonstrates use an indexer, datasource and skillset together. - - Indexer is used to efficiently write data to an index using a datasource. - So we first identify a supported data source - we use azure storage blobs - in this example. Then we create an index which is compatible with the datasource. - Further, we create an azure cognitive search datasource which we require to finally - create an indexer. - - Additionally, we will also use skillsets to provide some AI enhancements in our indexers. - - Once we create the indexer, we run the indexer and perform some basic operations like getting - the indexer status. - - The datasource used in this sample is stored as metadata for empty blobs in "searchcontainer". - The json file can be found in samples/files folder named hotel_small.json has the metdata of - each blob. -USAGE: - python sample_indexer_datasource_skillset.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_API_KEY - your search API key - 3) AZURE_STORAGE_CONNECTION_STRING - The connection string for the storage blob account that is - being used to create the datasource. -""" - -import os -import datetime - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -key = os.environ["AZURE_SEARCH_API_KEY"] -connection_string = os.environ["AZURE_STORAGE_CONNECTION_STRING"] - -from azure.core.credentials import AzureKeyCredential -from azure.search.documents.indexes.models import ( - SearchIndexerDataContainer, - SearchIndex, - SearchIndexer, - SimpleField, - SearchFieldDataType, - EntityRecognitionSkill, - InputFieldMappingEntry, - OutputFieldMappingEntry, - SearchIndexerSkillset, - CorsOptions, - IndexingSchedule, - SearchableField, - IndexingParameters, - SearchIndexerDataSourceConnection, - IndexingParametersConfiguration, -) -from azure.search.documents.indexes import SearchIndexerClient, SearchIndexClient - - -def _create_index(): - name = "hotel-index" - - # Here we create an index with listed fields. - fields = [ - SimpleField(name="hotelId", type=SearchFieldDataType.String, filterable=True, sortable=True, key=True), - SearchableField(name="hotelName", type=SearchFieldDataType.String), - SimpleField(name="description", type=SearchFieldDataType.String), - SimpleField(name="descriptionFr", type=SearchFieldDataType.String), - SimpleField(name="category", type=SearchFieldDataType.String), - SimpleField(name="parkingIncluded", type=SearchFieldDataType.Boolean, filterable=True), - SimpleField(name="smokingAllowed", type=SearchFieldDataType.Boolean, filterable=True), - SimpleField(name="lastRenovationDate", type=SearchFieldDataType.String), - SimpleField(name="rating", type=SearchFieldDataType.Int64, sortable=True), - SimpleField(name="location", type=SearchFieldDataType.GeographyPoint), - ] - cors_options = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60) - - # pass in the name, fields and cors options and create the index - index = SearchIndex(name=name, fields=fields, cors_options=cors_options) - index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - result = index_client.create_index(index) - return result - - -def _create_datasource(): - # Here we create a datasource. As mentioned in the description we have stored it in - # "searchcontainer" - ds_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) - container = SearchIndexerDataContainer(name="searchcontainer") - data_source_connection = SearchIndexerDataSourceConnection( - name="hotel-datasource", type="azureblob", connection_string=connection_string, container=container - ) - data_source = ds_client.create_data_source_connection(data_source_connection) - return data_source - - -def _create_skillset(): - client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) - inp = InputFieldMappingEntry(name="text", source="/document/lastRenovationDate") - output = OutputFieldMappingEntry(name="dateTimes", target_name="RenovatedDate") - s = EntityRecognitionSkill(name="merge-skill", inputs=[inp], outputs=[output]) - - skillset = SearchIndexerSkillset(name="hotel-data-skill", skills=[s], description="example skillset") - result = client.create_skillset(skillset) - return result - - -def sample_indexer_workflow(): - # Now that we have a datasource and an index, we can create an indexer. - - skillset_name = _create_skillset().name - print("Skillset is created") - - ds_name = _create_datasource().name - print("Data source is created") - - ind_name = _create_index().name - print("Index is created") - - # we pass the data source, skillsets and targeted index to build an indexer - configuration = IndexingParametersConfiguration(parsing_mode="jsonArray", query_timeout=None) # type: ignore - parameters = IndexingParameters(configuration=configuration) - indexer = SearchIndexer( - name="hotel-data-indexer", - data_source_name=ds_name, - target_index_name=ind_name, - skillset_name=skillset_name, - parameters=parameters, - ) - - indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) - indexer_client.create_indexer(indexer) # create the indexer - - # to get an indexer - result = indexer_client.get_indexer("hotel-data-indexer") - print(result) - - # To run an indexer, we can use run_indexer() - indexer_client.run_indexer(result.name) - - # Using create or update to schedule an indexer - - schedule = IndexingSchedule(interval=datetime.timedelta(hours=24)) - result.schedule = schedule - updated_indexer = indexer_client.create_or_update_indexer(result) - - print(updated_indexer) - - # get the status of an indexer - indexer_client.get_indexer_status(updated_indexer.name) - - -if __name__ == "__main__": - sample_indexer_workflow() diff --git a/sdk/search/azure-search-documents/samples/sample_indexer_workflow.py b/sdk/search/azure-search-documents/samples/sample_indexer_workflow.py new file mode 100644 index 000000000000..12e3bb668c9a --- /dev/null +++ b/sdk/search/azure-search-documents/samples/sample_indexer_workflow.py @@ -0,0 +1,168 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to run an indexer with a data source and skillset. + +USAGE: + python sample_indexer_workflow.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_API_KEY - the admin key for your search service + 3) AZURE_STORAGE_CONNECTION_STRING - connection string for the Azure Storage account +""" + +import os + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +key = os.environ["AZURE_SEARCH_API_KEY"] +connection_string = os.environ["AZURE_STORAGE_CONNECTION_STRING"] + +index_name = "hotels-sample-index-indexer-workflow" +data_source_name = "hotels-sample-blob" +skillset_name = "hotels-sample-skillset" +indexer_name = "hotels-sample-indexer-indexer-workflow" +container_name = "hotels-sample-container" + + +def sample_indexer_workflow(): + # [START sample_indexer_workflow] + import datetime + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexerClient, SearchIndexClient + from azure.search.documents.indexes.models import ( + SearchIndexerDataContainer, + SearchIndex, + SearchIndexer, + SimpleField, + SearchFieldDataType, + EntityRecognitionSkill, + InputFieldMappingEntry, + OutputFieldMappingEntry, + SearchIndexerSkillset, + CorsOptions, + IndexingSchedule, + SearchableField, + IndexingParameters, + SearchIndexerDataSourceConnection, + IndexingParametersConfiguration, + ) + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + # 1. Create an index + fields = [ + SimpleField( + name="HotelId", + type=SearchFieldDataType.String, + filterable=True, + sortable=True, + key=True, + ), + SearchableField(name="HotelName", type=SearchFieldDataType.String), + SimpleField(name="Description", type=SearchFieldDataType.String), + SimpleField(name="Description_fr", type=SearchFieldDataType.String), + SimpleField(name="Category", type=SearchFieldDataType.String), + SimpleField( + name="ParkingIncluded", type=SearchFieldDataType.Boolean, filterable=True + ), + SimpleField( + name="SmokingAllowed", type=SearchFieldDataType.Boolean, filterable=True + ), + SimpleField(name="LastRenovationDate", type=SearchFieldDataType.String), + SimpleField(name="Rating", type=SearchFieldDataType.Double, sortable=True), + SimpleField(name="Location", type=SearchFieldDataType.GeographyPoint), + ] + cors_options = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60) + index = SearchIndex(name=index_name, fields=fields, cors_options=cors_options) + index_client.create_index(index) + print(f"Created: index '{index_name}'") + + # 2. Create a data source + container = SearchIndexerDataContainer(name=container_name) + data_source_connection = SearchIndexerDataSourceConnection( + name=data_source_name, + type="azureblob", + connection_string=connection_string, + container=container, + ) + indexer_client.create_data_source_connection(data_source_connection) + print(f"Created: data source '{data_source_name}'") + + # 3. Create a skillset + inp = InputFieldMappingEntry(name="text", source="/document/lastRenovationDate") + output = OutputFieldMappingEntry(name="dateTimes", target_name="RenovatedDate") + skill = EntityRecognitionSkill(name="merge-skill", inputs=[inp], outputs=[output]) + skillset = SearchIndexerSkillset( + name=skillset_name, skills=[skill], description="example skillset" + ) + indexer_client.create_skillset(skillset) + print(f"Created: skillset '{skillset_name}'") + + # 4. Create an indexer + configuration = IndexingParametersConfiguration(parsing_mode="jsonArray") + parameters = IndexingParameters(configuration=configuration) + indexer = SearchIndexer( + name=indexer_name, + data_source_name=data_source_name, + target_index_name=index_name, + skillset_name=skillset_name, + parameters=parameters, + ) + indexer_client.create_indexer(indexer) + print(f"Created: indexer '{indexer_name}'") + + # Get the indexer + result = indexer_client.get_indexer(indexer_name) + print(f"Retrieved: indexer '{result.name}'") + + # Run the indexer + indexer_client.run_indexer(result.name) + print("Started: indexer run") + + # Schedule the indexer + schedule = IndexingSchedule(interval=datetime.timedelta(hours=24)) + result.schedule = schedule + updated_indexer = indexer_client.create_or_update_indexer(result) + if updated_indexer.schedule is not None: + print(f"Scheduled: indexer every {updated_indexer.schedule.interval}") + + # Get indexer status + status = indexer_client.get_indexer_status(updated_indexer.name) + print(f"Status: indexer '{updated_indexer.name}' is {status.status}") + # [END sample_indexer_workflow] + + +def delete_indexer_workflow_resources(): + # [START delete_indexer_workflow_resources] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexerClient, SearchIndexClient + + indexer_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + indexer_client.delete_indexer(indexer_name) + print(f"Deleted: indexer '{indexer_name}'") + + indexer_client.delete_skillset(skillset_name) + print(f"Deleted: skillset '{skillset_name}'") + + indexer_client.delete_data_source_connection(data_source_name) + print(f"Deleted: data source '{data_source_name}'") + + index_client.delete_index(index_name) + print(f"Deleted: index '{index_name}'") + # [END delete_indexer_workflow_resources] + + +if __name__ == "__main__": + sample_indexer_workflow() + delete_indexer_workflow_resources() diff --git a/sdk/search/azure-search-documents/samples/sample_indexers_operations.py b/sdk/search/azure-search-documents/samples/sample_indexers_operations.py deleted file mode 100644 index ff854d51be96..000000000000 --- a/sdk/search/azure-search-documents/samples/sample_indexers_operations.py +++ /dev/null @@ -1,123 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_indexer_operations.py -DESCRIPTION: - This sample demonstrates how to get, create, update, or delete a Indexer. -USAGE: - python sample_indexer_operations.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_API_KEY - your search API key -""" - -import os - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -key = os.environ["AZURE_SEARCH_API_KEY"] -connection_string = os.environ["AZURE_STORAGE_CONNECTION_STRING"] - -from azure.core.credentials import AzureKeyCredential -from azure.search.documents.indexes.models import ( - SearchIndexerDataContainer, - SearchIndexerDataSourceConnection, - SearchIndex, - SearchIndexer, - SimpleField, - SearchFieldDataType, -) -from azure.search.documents.indexes import SearchIndexClient, SearchIndexerClient - -indexers_client = SearchIndexerClient(service_endpoint, AzureKeyCredential(key)) - - -def create_indexer(): - # create an index - index_name = "indexer-hotels" - fields = [ - SimpleField(name="hotelId", type=SearchFieldDataType.String, key=True), - SimpleField(name="baseRate", type=SearchFieldDataType.Double), - ] - index = SearchIndex(name=index_name, fields=fields) - ind_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - ind_client.create_index(index) - - # [START create_indexer] - # create a datasource - container = SearchIndexerDataContainer(name="searchcontainer") - data_source_connection = SearchIndexerDataSourceConnection( - name="indexer-datasource", type="azureblob", connection_string=connection_string, container=container - ) - data_source = indexers_client.create_data_source_connection(data_source_connection) - - # create an indexer - indexer = SearchIndexer( - name="sample-indexer", data_source_name="indexer-datasource", target_index_name="indexer-hotels" - ) - result = indexers_client.create_indexer(indexer) - print("Create new Indexer - sample-indexer") - # [END create_indexer] - - -def list_indexers(): - # [START list_indexer] - result = indexers_client.get_indexers() - names = [x.name for x in result] - print("Found {} Indexers in the service: {}".format(len(result), ", ".join(names))) - # [END list_indexer] - - -def get_indexer(): - # [START get_indexer] - result = indexers_client.get_indexer("sample-indexer") - print("Retrived Indexer 'sample-indexer'") - return result - # [END get_indexer] - - -def get_indexer_status(): - # [START get_indexer_status] - result = indexers_client.get_indexer_status("sample-indexer") - print("Retrived Indexer status for 'sample-indexer'") - return result - # [END get_indexer_status] - - -def run_indexer(): - # [START run_indexer] - result = indexers_client.run_indexer("sample-indexer") - print("Ran the Indexer 'sample-indexer'") - return result - # [END run_indexer] - - -def reset_indexer(): - # [START reset_indexer] - result = indexers_client.reset_indexer("sample-indexer") - print("Reset the Indexer 'sample-indexer'") - return result - # [END reset_indexer] - - -def delete_indexer(): - # [START delete_indexer] - indexers_client.delete_indexer("sample-indexer") - print("Indexer 'sample-indexer' successfully deleted") - # [END delete_indexer] - - -if __name__ == "__main__": - create_indexer() - list_indexers() - get_indexer() - get_indexer_status() - run_indexer() - reset_indexer() - delete_indexer() diff --git a/sdk/search/azure-search-documents/samples/sample_autocomplete.py b/sdk/search/azure-search-documents/samples/sample_query_autocomplete.py similarity index 52% rename from sdk/search/azure-search-documents/samples/sample_autocomplete.py rename to sdk/search/azure-search-documents/samples/sample_query_autocomplete.py index 7846637b5dbc..4df5327c3371 100644 --- a/sdk/search/azure-search-documents/samples/sample_autocomplete.py +++ b/sdk/search/azure-search-documents/samples/sample_query_autocomplete.py @@ -1,23 +1,22 @@ # coding: utf-8 # ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. # -------------------------------------------------------------------------- """ -FILE: sample_autocomplete.py DESCRIPTION: - This sample demonstrates how to obtain autocompletion suggestions from an - Azure Search index. + Demonstrates how to retrieve autocomplete suggestions. + USAGE: - python sample_autocomplete.py + python sample_query_autocomplete.py - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the admin key for your search service """ import os @@ -36,9 +35,9 @@ def autocomplete_query(): results = search_client.autocomplete(search_text="bo", suggester_name="sg") - print("Autocomplete suggestions for 'bo'") + print("Results: autocomplete for 'bo'") for result in results: - print(" Completion: {}".format(result["text"])) + print(f" Completion: {result['text']}") # [END autocomplete_query] diff --git a/sdk/search/azure-search-documents/samples/sample_query_facets.py b/sdk/search/azure-search-documents/samples/sample_query_facets.py new file mode 100644 index 000000000000..4ff9245422c0 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/sample_query_facets.py @@ -0,0 +1,50 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to retrieve facets in search results. + +USAGE: + python sample_query_facets.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the admin key for your search service +""" + +import os + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] + + +def facet_query(): + # [START facet_query] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents import SearchClient + + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + results = search_client.search( + search_text="WiFi", facets=["Category,count:3", "ParkingIncluded"] + ) + + facets = results.get_facets() + + print("Results: category facets") + if facets: + for facet in facets["Category"]: + print(f" {facet}") + # [END facet_query] + + +if __name__ == "__main__": + facet_query() diff --git a/sdk/search/azure-search-documents/samples/sample_query_filter.py b/sdk/search/azure-search-documents/samples/sample_query_filter.py new file mode 100644 index 000000000000..dbc1faa0c961 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/sample_query_filter.py @@ -0,0 +1,50 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to filter and sort search results. + +USAGE: + python sample_query_filter.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + (e.g., https://.search.windows.net) + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the admin key for your search service +""" + +import os + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] + + +def filter_query(): + # [START filter_query] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents import SearchClient + + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + results = search_client.search( + search_text="WiFi", + filter="Address/StateProvince eq 'FL' and Address/Country eq 'USA'", + select=["HotelName", "Rating"], + order_by=["Rating desc"], + ) + + print("Results: Florida hotels with WiFi (sorted by rating)") + for result in results: + print(f" HotelName: {result['HotelName']} (rating {result['Rating']})") + # [END filter_query] + + +if __name__ == "__main__": + filter_query() diff --git a/sdk/search/azure-search-documents/samples/sample_query_semantic.py b/sdk/search/azure-search-documents/samples/sample_query_semantic.py new file mode 100644 index 000000000000..bffdf3f8f3fc --- /dev/null +++ b/sdk/search/azure-search-documents/samples/sample_query_semantic.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to perform semantic search. +USAGE: + python sample_query_semantic.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the primary admin key for your search service +""" + +import os + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] +semantic_configuration_name = "hotels-sample-semantic-config" + + +def create_semantic_configuration(): + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexClient + from azure.search.documents.indexes.models import ( + SemanticConfiguration, + SemanticPrioritizedFields, + SemanticField, + SemanticSearch, + ) + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + index = index_client.get_index(index_name) + + semantic_config = SemanticConfiguration( + name=semantic_configuration_name, + prioritized_fields=SemanticPrioritizedFields( + title_field=SemanticField(field_name="HotelName"), + content_fields=[SemanticField(field_name="Description")], + keywords_fields=[SemanticField(field_name="Tags")], + ), + ) + + index.semantic_search = SemanticSearch(configurations=[semantic_config]) + index_client.create_or_update_index(index) + print( + f"Updated: index '{index_name}' (semantic config '{semantic_configuration_name}')" + ) + + +def speller(): + # [START speller] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents import SearchClient + + credential = AzureKeyCredential(key) + search_client = SearchClient( + endpoint=service_endpoint, index_name=index_name, credential=credential + ) + results = list( + search_client.search( + search_text="luxury", query_language="en-us", query_speller="lexicon" + ) + ) + + print("Results: speller") + for result in results: + print(f" HotelId: {result['HotelId']}") + print(f" HotelName: {result['HotelName']}") + # [END speller] + + +def semantic_ranking(): + # [START semantic_ranking] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents import SearchClient + + credential = AzureKeyCredential(key) + search_client = SearchClient( + endpoint=service_endpoint, index_name=index_name, credential=credential + ) + results = list( + search_client.search( + search_text="luxury", + query_type="semantic", + semantic_configuration_name=semantic_configuration_name, + query_language="en-us", + ) + ) + + print("Results: semantic ranking") + for result in results: + print(f" HotelId: {result['HotelId']}") + print(f" HotelName: {result['HotelName']}") + # [END semantic_ranking] + + +def delete_semantic_configuration(): + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexClient + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + index = index_client.get_index(index_name) + + index.semantic_search = None + index_client.create_or_update_index(index) + print(f"Deleted: semantic config from index '{index_name}'") + + +if __name__ == "__main__": + create_semantic_configuration() + speller() + semantic_ranking() + delete_semantic_configuration() diff --git a/sdk/search/azure-search-documents/samples/sample_query_session.py b/sdk/search/azure-search-documents/samples/sample_query_session.py index 64e783ff636a..4820f7bbc086 100644 --- a/sdk/search/azure-search-documents/samples/sample_query_session.py +++ b/sdk/search/azure-search-documents/samples/sample_query_session.py @@ -1,24 +1,20 @@ # coding: utf-8 # ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. # -------------------------------------------------------------------------- """ -FILE: sample_query_session.py DESCRIPTION: - To ensure more consistent and unique search results within a user's session, you can use session id. - Simply include the session_id parameter in your queries to create a unique identifier for each user session. - This ensures a uniform experience for users throughout their "query session". + Demonstrates how to use session IDs for consistent scoring. USAGE: python sample_query_session.py - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the primary admin key for your search service """ import os @@ -37,9 +33,9 @@ def query_session(): results = search_client.search(search_text="spa", session_id="session-1") - print("Hotels containing 'spa' in the name (or other fields):") + print("Results: hotels with 'spa'") for result in results: - print(" Name: {} (rating {})".format(result["hotelName"], result["rating"])) + print(f" HotelName: {result['HotelName']} (rating {result['Rating']})") # [END query_session] diff --git a/sdk/search/azure-search-documents/samples/sample_query_simple.py b/sdk/search/azure-search-documents/samples/sample_query_simple.py new file mode 100644 index 000000000000..c7211692103d --- /dev/null +++ b/sdk/search/azure-search-documents/samples/sample_query_simple.py @@ -0,0 +1,43 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to perform a simple text search. +USAGE: + python sample_query_simple.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the primary admin key for your search service +""" + +import os + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] + + +def simple_query(): + # [START simple_query] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents import SearchClient + + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + results = search_client.search(search_text="spa") + + print("Results: hotels with 'spa'") + for result in results: + print(f" HotelName: {result['HotelName']} (rating {result['Rating']})") + # [END simple_query] + + +if __name__ == "__main__": + simple_query() diff --git a/sdk/search/azure-search-documents/samples/sample_query_suggestions.py b/sdk/search/azure-search-documents/samples/sample_query_suggestions.py new file mode 100644 index 000000000000..3bf3d9444022 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/sample_query_suggestions.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to retrieve search suggestions. +USAGE: + python sample_query_suggestions.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the primary admin key for your search service +""" + +import os + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] + + +def suggest_query(): + # [START suggest_query] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents import SearchClient + + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + results = search_client.suggest(search_text="coffee", suggester_name="sg") + + print("Results: suggestions for 'coffee'") + for result in results: + hotel = search_client.get_document(key=result["HotelId"]) + print(f" Text: {result['text']!r}, HotelName: {hotel['HotelName']}") + # [END suggest_query] + + +if __name__ == "__main__": + suggest_query() diff --git a/sdk/search/azure-search-documents/samples/sample_query_vector.py b/sdk/search/azure-search-documents/samples/sample_query_vector.py new file mode 100644 index 000000000000..043b5484d331 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/sample_query_vector.py @@ -0,0 +1,259 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to create a vector-enabled index, upload documents with + pre-computed DescriptionVector values, and run vector queries. + +USAGE: + python sample_query_vector.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + 2) AZURE_SEARCH_API_KEY - the primary admin key for your search service + +NOTE: + This sample uses a pre-computed vector for the query "quintessential lodging + near running trails, eateries, retail" instead of calling an embedding API. + The vector was generated using text-embedding-ada-002 (1536 dimensions). +""" + +import json +import os +from pathlib import Path +from azure.core.credentials import AzureKeyCredential +from azure.search.documents import SearchClient +from azure.search.documents.models import VectorizedQuery +from azure.search.documents.indexes import SearchIndexClient +from azure.search.documents.indexes.models import ( + SimpleField, + SearchField, + SearchFieldDataType, + SearchableField, + SearchIndex, + SemanticConfiguration, + SemanticField, + SemanticPrioritizedFields, + SemanticSearch, + VectorSearch, + VectorSearchProfile, + HnswAlgorithmConfiguration, + ExhaustiveKnnAlgorithmConfiguration, +) + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +key = os.environ["AZURE_SEARCH_API_KEY"] + +index_name = "hotels-sample-index-query-vector" +data_dir = Path(__file__).resolve().parent / "data" +documents_path = data_dir / "hotels_with_description_vector.json" +query_vector_path = data_dir / "query_vector.json" + + +def load_query_vector(query_vector_path): + """Load the query vector from the samples/data folder.""" + with open(query_vector_path, "r", encoding="utf-8") as handle: + return json.load(handle) + + +vector = load_query_vector(query_vector_path) + + +def create_index(): + """Create or update the vector-enabled search index.""" + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + + fields = [ + SimpleField( + name="HotelId", type=SearchFieldDataType.String, key=True, filterable=True + ), + SearchableField( + name="HotelName", type=SearchFieldDataType.String, sortable=True + ), + SearchableField(name="Description", type=SearchFieldDataType.String), + SearchField( + name="DescriptionVector", + type=SearchFieldDataType.Collection(SearchFieldDataType.Single), + searchable=True, + vector_search_dimensions=1536, + vector_search_profile_name="my-vector-profile", + ), + SearchableField( + name="Category", + type=SearchFieldDataType.String, + sortable=True, + filterable=True, + facetable=True, + ), + SearchField( + name="Tags", + type=SearchFieldDataType.Collection(SearchFieldDataType.String), + searchable=True, + filterable=True, + facetable=True, + ), + ] + + vector_search = VectorSearch( + algorithms=[ + HnswAlgorithmConfiguration(name="my-hnsw-vector-config-1", kind="hnsw"), + ExhaustiveKnnAlgorithmConfiguration( + name="my-eknn-vector-config", kind="exhaustiveKnn" + ), + ], + profiles=[ + VectorSearchProfile( + name="my-vector-profile", + algorithm_configuration_name="my-hnsw-vector-config-1", + ) + ], + ) + + semantic_config = SemanticConfiguration( + name="my-semantic-config", + prioritized_fields=SemanticPrioritizedFields( + title_field=SemanticField(field_name="HotelName"), + content_fields=[SemanticField(field_name="Description")], + keywords_fields=[SemanticField(field_name="Category")], + ), + ) + + semantic_search = SemanticSearch(configurations=[semantic_config]) + + index = SearchIndex( + name=index_name, + fields=fields, + vector_search=vector_search, + semantic_search=semantic_search, + ) + + result = index_client.create_or_update_index(index) + print(f"Created: index '{result.name}'") + + +def load_documents(): + with open(documents_path, "r", encoding="utf-8") as handle: + raw = handle.read().strip() + + payload = json.loads(raw) + documents = payload["value"] + + return documents + + +def upload_documents(): + """Upload documents to the search index.""" + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + documents = load_documents() + result = search_client.upload_documents(documents=documents) + print(f"Uploaded: {len(result)} documents to index '{index_name}'") + + +def single_vector_search(): + """Perform a single vector search using a pre-computed query vector.""" + # [START single_vector_search] + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + vector_query = VectorizedQuery( + vector=vector, + k=5, + fields="DescriptionVector", + ) + + results = search_client.search( + vector_queries=[vector_query], + select=["HotelId", "HotelName", "Description", "Category", "Tags"], + top=5, + ) + + print("Results: single vector search") + for result in results: + print( + f" HotelId: {result['HotelId']}, HotelName: {result['HotelName']}, " + f"Category: {result.get('Category')}" + ) + # [END single_vector_search] + + +def single_vector_search_with_filter(): + """Perform a vector search with a filter applied.""" + # [START single_vector_search_with_filter] + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + vector_query = VectorizedQuery( + vector=vector, + k=5, + fields="DescriptionVector", + ) + + results = search_client.search( + vector_queries=[vector_query], + filter="Tags/any(tag: tag eq 'free wifi')", + select=["HotelId", "HotelName", "Description", "Category", "Tags"], + top=5, + ) + + print("Results: vector search with filter") + for result in results: + print( + f" HotelId: {result['HotelId']}, HotelName: {result['HotelName']}, " + f"Tags: {result.get('Tags')}" + ) + # [END single_vector_search_with_filter] + + +def simple_hybrid_search(): + """Perform a hybrid search combining vector and text search.""" + # [START simple_hybrid_search] + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + vector_query = VectorizedQuery( + vector=vector, + k=5, + fields="DescriptionVector", + ) + + results = search_client.search( + search_text="historic hotel walk to restaurants and shopping", + vector_queries=[vector_query], + select=["HotelId", "HotelName", "Description", "Category", "Tags"], + top=5, + ) + + print("Results: hybrid search") + for result in results: + score = result.get("@search.score", "N/A") + print(f" Score: {score}") + print(f" HotelId: {result['HotelId']}") + print(f" HotelName: {result['HotelName']}") + print(f" Description: {result.get('Description')}") + print(f" Category: {result.get('Category')}") + print(f" Tags: {result.get('Tags', 'N/A')}") + print() + # [END simple_hybrid_search] + + +def delete_index(): + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + index_client.delete_index(index_name) + print(f"Deleted: index '{index_name}'") + + +if __name__ == "__main__": + print("Query: 'quintessential lodging near running trails, eateries, retail'") + try: + create_index() + upload_documents() + single_vector_search() + print() + single_vector_search_with_filter() + print() + simple_hybrid_search() + print() + finally: + delete_index() diff --git a/sdk/search/azure-search-documents/samples/sample_search_client_custom_request.py b/sdk/search/azure-search-documents/samples/sample_search_client_custom_request.py new file mode 100644 index 000000000000..43040de55cbf --- /dev/null +++ b/sdk/search/azure-search-documents/samples/sample_search_client_custom_request.py @@ -0,0 +1,48 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +""" +DESCRIPTION: + Demonstrates how to make custom HTTP requests using SearchClient. + +USAGE: + python sample_search_client_custom_request.py + + Set the following environment variables before running the sample: + 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service + 2) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") + 3) AZURE_SEARCH_API_KEY - the primary admin key for your search service +""" + +import os + +service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] +index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] +key = os.environ["AZURE_SEARCH_API_KEY"] + + +def sample_send_request(): + from azure.core.credentials import AzureKeyCredential + from azure.core.rest import HttpRequest + from azure.search.documents import SearchClient + from sample_utils import AZURE_SEARCH_API_VERSION + + search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) + + # The `send_request` method can send custom HTTP requests that share the client's existing pipeline, + # while adding convenience for endpoint construction. + request = HttpRequest( + method="GET", url=f"/docs/$count?api-version={AZURE_SEARCH_API_VERSION}" + ) + response = search_client.send_request(request) + response.raise_for_status() + response_body = response.json() + print(f"Document count: {response_body} (index '{index_name}')") + + +if __name__ == "__main__": + sample_send_request() diff --git a/sdk/search/azure-search-documents/samples/sample_search_client_send_request.py b/sdk/search/azure-search-documents/samples/sample_search_client_send_request.py deleted file mode 100644 index 616d04fe0e52..000000000000 --- a/sdk/search/azure-search-documents/samples/sample_search_client_send_request.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_search_client_send_request.py - -DESCRIPTION: - This sample demonstrates how to make custom HTTP requests through a client pipeline. - -USAGE: - python sample_search_client_send_request.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import os -from azure.core.credentials import AzureKeyCredential -from azure.core.rest import HttpRequest -from azure.search.documents import SearchClient - - -def sample_send_request(): - endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] - index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] - key = os.environ["AZURE_SEARCH_API_KEY"] - - client = SearchClient(endpoint, index_name, AzureKeyCredential(key)) - - # The `send_request` method can send custom HTTP requests that share the client's existing pipeline, - # while adding convenience for endpoint construction. - request = HttpRequest(method="GET", url=f"/docs/$count?api-version=2024-05-01-preview") - response = client.send_request(request) - response.raise_for_status() - response_body = response.json() - print(response_body) - - -if __name__ == "__main__": - sample_send_request() diff --git a/sdk/search/azure-search-documents/samples/sample_semantic_search.py b/sdk/search/azure-search-documents/samples/sample_semantic_search.py deleted file mode 100644 index c6e5be9c57ad..000000000000 --- a/sdk/search/azure-search-documents/samples/sample_semantic_search.py +++ /dev/null @@ -1,70 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_semantic_search.py -DESCRIPTION: - This sample demonstrates how to use semantic search. -USAGE: - python sample_semantic_search.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import os - - -def speller(): - # [START speller] - from azure.core.credentials import AzureKeyCredential - from azure.search.documents import SearchClient - - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] - index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] - key = os.environ["AZURE_SEARCH_API_KEY"] - - credential = AzureKeyCredential(key) - client = SearchClient(endpoint=service_endpoint, index_name=index_name, credential=credential) - results = list(client.search(search_text="luxury", query_language="en-us", query_speller="lexicon")) - - for result in results: - print("{}\n{}\n)".format(result["hotelId"], result["hotelName"])) - # [END speller] - - -def semantic_ranking(): - # [START semantic_ranking] - from azure.core.credentials import AzureKeyCredential - from azure.search.documents import SearchClient - - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] - index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] - key = os.environ["AZURE_SEARCH_API_KEY"] - - credential = AzureKeyCredential(key) - client = SearchClient(endpoint=service_endpoint, index_name=index_name, credential=credential) - results = list( - client.search( - search_text="luxury", - query_type="semantic", - semantic_configuration_name="semantic_config_name", - query_language="en-us", - ) - ) - - for result in results: - print("{}\n{}\n)".format(result["hotelId"], result["hotelName"])) - # [END semantic_ranking] - - -if __name__ == "__main__": - speller() - semantic_ranking() diff --git a/sdk/search/azure-search-documents/samples/sample_simple_query.py b/sdk/search/azure-search-documents/samples/sample_simple_query.py deleted file mode 100644 index 9f2317a008e3..000000000000 --- a/sdk/search/azure-search-documents/samples/sample_simple_query.py +++ /dev/null @@ -1,46 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_simple_query.py -DESCRIPTION: - This sample demonstrates how to get search results from a basic search text - from an Azure Search index. -USAGE: - python sample_simple_query.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import os - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] -key = os.environ["AZURE_SEARCH_API_KEY"] - - -def simple_text_query(): - # [START simple_query] - from azure.core.credentials import AzureKeyCredential - from azure.search.documents import SearchClient - - search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) - - results = search_client.search(search_text="spa") - - print("Hotels containing 'spa' in the name (or other fields):") - for result in results: - print(" Name: {} (rating {})".format(result["hotelName"], result["rating"])) - # [END simple_query] - - -if __name__ == "__main__": - simple_text_query() diff --git a/sdk/search/azure-search-documents/samples/sample_suggestions.py b/sdk/search/azure-search-documents/samples/sample_suggestions.py deleted file mode 100644 index e24478418b25..000000000000 --- a/sdk/search/azure-search-documents/samples/sample_suggestions.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_suggestions.py -DESCRIPTION: - This sample demonstrates how to obtain search suggestions from an Azure - search index -USAGE: - python sample_suggestions.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import os - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] -key = os.environ["AZURE_SEARCH_API_KEY"] - - -def suggest_query(): - # [START suggest_query] - from azure.core.credentials import AzureKeyCredential - from azure.search.documents import SearchClient - - search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) - - results = search_client.suggest(search_text="coffee", suggester_name="sg") - - print("Search suggestions for 'coffee'") - for result in results: - hotel = search_client.get_document(key=result["hotelId"]) - print(" Text: {} for Hotel: {}".format(repr(result["text"]), hotel["hotelName"])) - # [END suggest_query] - - -if __name__ == "__main__": - suggest_query() diff --git a/sdk/search/azure-search-documents/samples/sample_synonym_map_operations.py b/sdk/search/azure-search-documents/samples/sample_synonym_map_operations.py deleted file mode 100644 index c6f8b9575f40..000000000000 --- a/sdk/search/azure-search-documents/samples/sample_synonym_map_operations.py +++ /dev/null @@ -1,89 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_synonym_map_operations.py -DESCRIPTION: - This sample demonstrates how to get, create, update, or delete a Synonym Map. -USAGE: - python sample_synonym_map_operations.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_API_KEY - your search API key -""" - -import os - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -key = os.environ["AZURE_SEARCH_API_KEY"] - -from azure.core.credentials import AzureKeyCredential -from azure.search.documents.indexes import SearchIndexClient -from azure.search.documents.indexes.models import SynonymMap - -client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - - -def create_synonym_map(): - # [START create_synonym_map] - synonyms = [ - "USA, United States, United States of America", - "Washington, Wash. => WA", - ] - synonym_map = SynonymMap(name="test-syn-map", synonyms=synonyms) - result = client.create_synonym_map(synonym_map) - print("Create new Synonym Map 'test-syn-map succeeded") - # [END create_synonym_map] - - -def create_synonym_map_from_file(): - # [START create_synonym_map_from_file] - from os.path import dirname, join, realpath - - CWD = dirname(realpath(__file__)) - file_path = join(CWD, "synonym_map.txt") - with open(file_path, "r") as f: - solr_format_synonyms = f.read() - synonyms = solr_format_synonyms.split("\n") - synonym_map = SynonymMap(name="test-syn-map", synonyms=synonyms) - result = client.create_synonym_map(synonym_map) - print("Create new Synonym Map 'test-syn-map succeeded") - # [END create_synonym_map_from_file] - - -def get_synonym_maps(): - # [START get_synonym_maps] - result = client.get_synonym_maps() - names = [x.name for x in result] - print("Found {} Synonym Maps in the service: {}".format(len(result), ", ".join(names))) - # [END get_synonym_maps] - - -def get_synonym_map(): - # [START get_synonym_map] - result = client.get_synonym_map("test-syn-map") - print("Retrived Synonym Map 'test-syn-map' with synonyms") - if result: - for syn in result.synonyms: - print(" {}".format(syn)) - # [END get_synonym_map] - - -def delete_synonym_map(): - # [START delete_synonym_map] - client.delete_synonym_map("test-syn-map") - print("Synonym Map 'test-syn-map' deleted") - # [END delete_synonym_map] - - -if __name__ == "__main__": - create_synonym_map() - get_synonym_maps() - get_synonym_map() - delete_synonym_map() diff --git a/sdk/search/azure-search-documents/samples/sample_utils.py b/sdk/search/azure-search-documents/samples/sample_utils.py new file mode 100644 index 000000000000..fa6abd801068 --- /dev/null +++ b/sdk/search/azure-search-documents/samples/sample_utils.py @@ -0,0 +1,8 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# -------------------------------------------------------------------------- + +AZURE_SEARCH_API_VERSION = "2025-11-01-preview" diff --git a/sdk/search/azure-search-documents/samples/sample_vector_search.py b/sdk/search/azure-search-documents/samples/sample_vector_search.py deleted file mode 100644 index b7bfbc31d44a..000000000000 --- a/sdk/search/azure-search-documents/samples/sample_vector_search.py +++ /dev/null @@ -1,204 +0,0 @@ -# coding: utf-8 - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: sample_vector_search.py -DESCRIPTION: - This sample demonstrates how to get search results from a basic search text - from an Azure Search index. -USAGE: - python sample_vector_search.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_SEARCH_SERVICE_ENDPOINT - the endpoint of your Azure Cognitive Search service - 2) AZURE_SEARCH_INDEX_NAME - the name of your search index (e.g. "hotels-sample-index") - 3) AZURE_SEARCH_API_KEY - your search API key -""" - -import os - -from azure.core.credentials import AzureKeyCredential -from azure.search.documents import SearchClient -from azure.search.documents.indexes import SearchIndexClient -from azure.search.documents.models import VectorizedQuery - -service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] -index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] -key = os.environ["AZURE_SEARCH_API_KEY"] - - -def get_embeddings(text: str): - # There are a few ways to get embeddings. This is just one example. - import openai - - open_ai_endpoint = os.getenv("OpenAIEndpoint") - open_ai_key = os.getenv("OpenAIKey") - - client = openai.AzureOpenAI( - azure_endpoint=open_ai_endpoint, - api_key=open_ai_key, - api_version="2023-09-01-preview", - ) - embedding = client.embeddings.create(input=[text], model="text-embedding-ada-002") - return embedding.data[0].embedding - - -def get_hotel_index(name: str): - from azure.search.documents.indexes.models import ( - SearchIndex, - SearchField, - SearchFieldDataType, - SimpleField, - SearchableField, - VectorSearch, - VectorSearchProfile, - HnswAlgorithmConfiguration, - ) - - fields = [ - SimpleField(name="hotelId", type=SearchFieldDataType.String, key=True), - SearchableField( - name="hotelName", - type=SearchFieldDataType.String, - sortable=True, - filterable=True, - ), - SearchableField(name="description", type=SearchFieldDataType.String), - SearchField( - name="descriptionVector", - type=SearchFieldDataType.Collection(SearchFieldDataType.Single), - searchable=True, - vector_search_dimensions=1536, - vector_search_profile_name="my-vector-config", - ), - SearchableField( - name="category", - type=SearchFieldDataType.String, - sortable=True, - filterable=True, - facetable=True, - ), - ] - vector_search = VectorSearch( - profiles=[VectorSearchProfile(name="my-vector-config", algorithm_configuration_name="my-algorithms-config")], - algorithms=[HnswAlgorithmConfiguration(name="my-algorithms-config")], - ) - return SearchIndex(name=name, fields=fields, vector_search=vector_search) - - -def get_hotel_documents(): - docs = [ - { - "hotelId": "1", - "hotelName": "Fancy Stay", - "description": "Best hotel in town if you like luxury hotels.", - "descriptionVector": get_embeddings("Best hotel in town if you like luxury hotels."), - "category": "Luxury", - }, - { - "hotelId": "2", - "hotelName": "Roach Motel", - "description": "Cheapest hotel in town. Infact, a motel.", - "descriptionVector": get_embeddings("Cheapest hotel in town. Infact, a motel."), - "category": "Budget", - }, - { - "hotelId": "3", - "hotelName": "EconoStay", - "description": "Very popular hotel in town.", - "descriptionVector": get_embeddings("Very popular hotel in town."), - "category": "Budget", - }, - { - "hotelId": "4", - "hotelName": "Modern Stay", - "description": "Modern architecture, very polite staff and very clean. Also very affordable.", - "descriptionVector": get_embeddings( - "Modern architecture, very polite staff and very clean. Also very affordable." - ), - "category": "Luxury", - }, - { - "hotelId": "5", - "hotelName": "Secret Point", - "description": "One of the best hotel in town. The hotel is ideally located on the main commercial artery of the city in the heart of New York.", - "descriptionVector": get_embeddings( - "One of the best hotel in town. The hotel is ideally located on the main commercial artery of the city in the heart of New York." - ), - "category": "Boutique", - }, - ] - return docs - - -def single_vector_search(): - # [START single_vector_search] - query = "Top hotels in town" - - search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) - vector_query = VectorizedQuery(vector=get_embeddings(query), k_nearest_neighbors=3, fields="descriptionVector") - - results = search_client.search( - vector_queries=[vector_query], - select=["hotelId", "hotelName"], - ) - - for result in results: - print(result) - # [END single_vector_search] - - -def single_vector_search_with_filter(): - # [START single_vector_search_with_filter] - query = "Top hotels in town" - - search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) - vector_query = VectorizedQuery(vector=get_embeddings(query), k_nearest_neighbors=3, fields="descriptionVector") - - results = search_client.search( - search_text="", - vector_queries=[vector_query], - filter="category eq 'Luxury'", - select=["hotelId", "hotelName"], - ) - - for result in results: - print(result) - # [END single_vector_search_with_filter] - - -def simple_hybrid_search(): - # [START simple_hybrid_search] - query = "Top hotels in town" - - search_client = SearchClient(service_endpoint, index_name, AzureKeyCredential(key)) - vector_query = VectorizedQuery(vector=get_embeddings(query), k_nearest_neighbors=3, fields="descriptionVector") - - results = search_client.search( - search_text=query, - vector_queries=[vector_query], - select=["hotelId", "hotelName"], - ) - - for result in results: - print(result) - # [END simple_hybrid_search] - - -if __name__ == "__main__": - credential = AzureKeyCredential(key) - index_client = SearchIndexClient(service_endpoint, credential) - index = get_hotel_index(index_name) - index_client.create_index(index) - client = SearchClient(service_endpoint, index_name, credential) - hotel_docs = get_hotel_documents() - client.upload_documents(documents=hotel_docs) - - single_vector_search() - single_vector_search_with_filter() - simple_hybrid_search()