From 263464f36aa4bb9e38d4c5625b3916723ee03009 Mon Sep 17 00:00:00 2001 From: Xiang Yan Date: Tue, 13 Apr 2021 10:08:36 -0700 Subject: [PATCH] fix search fields --- .../azure/search/documents/_search_client.py | 9 ++++++--- .../azure/search/documents/aio/_search_client_async.py | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) 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 f31295161fa4..9bd96f81c717 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 @@ -242,6 +242,7 @@ def search(self, search_text, **kwargs): scoring_parameters = kwargs.pop("scoring_parameters", None) scoring_profile = kwargs.pop("scoring_profile", None) search_fields = kwargs.pop("search_fields", None) + search_fields_str = ",".join(search_fields) if search_fields else None search_mode = kwargs.pop("search_mode", None) query_language = kwargs.pop("query_language", None) speller = kwargs.pop("speller", None) @@ -262,7 +263,7 @@ def search(self, search_text, **kwargs): query_type=query_type, scoring_parameters=scoring_parameters, scoring_profile=scoring_profile, - search_fields=search_fields, + search_fields=search_fields_str, search_mode=search_mode, query_language=query_language, speller=speller, @@ -333,6 +334,7 @@ def suggest(self, search_text, suggester_name, **kwargs): minimum_coverage = kwargs.pop("minimum_coverage", None) order_by = kwargs.pop("order_by", None) search_fields = kwargs.pop("search_fields", None) + search_fields_str = ",".join(search_fields) if search_fields else None select = kwargs.pop("select", None) top = kwargs.pop("top", None) query = SuggestQuery( @@ -344,7 +346,7 @@ def suggest(self, search_text, suggester_name, **kwargs): highlight_pre_tag=highlight_pre_tag, minimum_coverage=minimum_coverage, order_by=order_by, - search_fields=search_fields, + search_fields=search_fields_str, select=select if isinstance(select, six.string_types) else None, top=top ) @@ -406,6 +408,7 @@ def autocomplete(self, search_text, suggester_name, **kwargs): highlight_pre_tag = kwargs.pop("highlight_pre_tag", None) minimum_coverage = kwargs.pop("minimum_coverage", None) search_fields = kwargs.pop("search_fields", None) + search_fields_str = ",".join(search_fields) if search_fields else None top = kwargs.pop("top", None) query = AutocompleteQuery( search_text=search_text, @@ -416,7 +419,7 @@ def autocomplete(self, search_text, suggester_name, **kwargs): highlight_post_tag=highlight_post_tag, highlight_pre_tag=highlight_pre_tag, minimum_coverage=minimum_coverage, - search_fields=search_fields, + search_fields=search_fields_str, top=top ) 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 00a35a823698..0e70771d1e9f 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 @@ -216,6 +216,7 @@ async def search(self, search_text, **kwargs): scoring_parameters = kwargs.pop("scoring_parameters", None) scoring_profile = kwargs.pop("scoring_profile", None) search_fields = kwargs.pop("search_fields", None) + search_fields_str = ",".join(search_fields) if search_fields else None search_mode = kwargs.pop("search_mode", None) query_language = kwargs.pop("query_language", None) speller = kwargs.pop("speller", None) @@ -236,7 +237,7 @@ async def search(self, search_text, **kwargs): query_type=query_type, scoring_parameters=scoring_parameters, scoring_profile=scoring_profile, - search_fields=search_fields, + search_fields=search_fields_str, search_mode=search_mode, query_language=query_language, speller=speller, @@ -306,6 +307,7 @@ async def suggest(self, search_text, suggester_name, **kwargs): minimum_coverage = kwargs.pop("minimum_coverage", None) order_by = kwargs.pop("order_by", None) search_fields = kwargs.pop("search_fields", None) + search_fields_str = ",".join(search_fields) if search_fields else None select = kwargs.pop("select", None) top = kwargs.pop("top", None) query = SuggestQuery( @@ -317,7 +319,7 @@ async def suggest(self, search_text, suggester_name, **kwargs): highlight_pre_tag=highlight_pre_tag, minimum_coverage=minimum_coverage, order_by=order_by, - search_fields=search_fields, + search_fields=search_fields_str, select=select if isinstance(select, six.string_types) else None, top=top ) @@ -379,6 +381,7 @@ async def autocomplete(self, search_text, suggester_name, **kwargs): highlight_pre_tag = kwargs.pop("highlight_pre_tag", None) minimum_coverage = kwargs.pop("minimum_coverage", None) search_fields = kwargs.pop("search_fields", None) + search_fields_str = ",".join(search_fields) if search_fields else None top = kwargs.pop("top", None) query = AutocompleteQuery( search_text=search_text, @@ -389,7 +392,7 @@ async def autocomplete(self, search_text, suggester_name, **kwargs): highlight_post_tag=highlight_post_tag, highlight_pre_tag=highlight_pre_tag, minimum_coverage=minimum_coverage, - search_fields=search_fields, + search_fields=search_fields_str, top=top )