搜索具有特殊字符.net SDK版本5.0.3的字段

时间:2019-03-05 16:34:58

标签: azure-search azure-search-.net-sdk

嗨,我正在尝试使用.net SDK进行天蓝色搜索。我正在搜索的字段包含“ /”字符。但是,无论我做什么,搜索结果总是空白。我已经尝试过HttpUtility.UrlEncode,但仍然无法正常工作。以下是我尝试过的代码。有人可以帮忙吗,

 using (var searchClient = _azureSearchConnector.GetSearchClient(_searchIndexName))
            {
                var searchParams = new SearchParameters
                {
                    //example location = contact/DCA-000021978/AzureSearch/
                    Filter = $"fileLocation eq ' {location}'",
                    Select = new[] { "metadata_storage_name", "user", "metadata_storage_content_type",
                    "metadata_storage_size", "metadata_storage_last_modified",
                    "metadata_creation_date", "metadata_storage_path", "fileLocation"},
                };

                var result = searchClient.Documents.SearchWithHttpMessagesAsync("*", searchParams).Result;

                return result.Body.Results.Select(t => (DocumentSearchModel)t.Document);
            }

0 个答案:

没有答案