azure-search-.net-sdk

Synonym Maps in Azure Search, synonym phrases

落爺英雄遲暮 提交于 2020-01-05 06:31:08
问题 I'm trying to use synonym maps in Azure Search and i'm running into a problem. I want to have several words and phrases map into a single search query. In other words, when i search for either: product 123 , product0123 , product 0123 i want the search to return results for a query phrase: product123 . After reading the tutorial it all seemed pretty straight forward. I'm using .Net Azure.Search SDK 5.0 so i've done the following: var synonymMap = new SynonymMap { Name = "test-map", Format =

Upgrading Azure Search SDK from v.5.0.3 to v.9. Search call hangs

拥有回忆 提交于 2019-12-19 10:17:47
问题 After upgrading the .net Azure Search SDK to version 9, I am unable to search. The call just hangs on: azureSearchIndexClient.Documents.Search(query, parameters); I don't receive an error, everything was working on 5.0.3, I can still create, populate, and delete indexes in version 9. Without any response, I have little to go on... 回答1: This is a bug in version 9.0.0 of the SDK, tracked here: https://github.com/Azure/azure-sdk-for-net/issues/6254 It has since been fixed in version 9.0.1, now

How to wait for Azure Search to finish indexing document? For integration testing purpose

余生长醉 提交于 2019-12-19 03:57:00
问题 Scenario I'm building a suite of automated integration tests. Each test push data into the Azure Search index before querying it and verifying the expected results. Problem The indexation happens asynchronously in the service and data aren't immediatly available after the indexing call returns successfully. The test execute of course too rapidly most of the time. What I've tried I've tried querying the document until it's found: // Wait for the indexed document to become available while

Azure Search using REST c#

ぐ巨炮叔叔 提交于 2019-12-13 03:46:27
问题 I am trying to run the following code: public class Item { [JsonProperty(PropertyName = "api-key")] public string apikey { get; set; } } [[some method]]{ var url = "https://[search service name].search.windows.net/indexes/temp?api-version=2016-09-01"; using (var httpClient = new HttpClient()) { using (var request = new HttpRequestMessage(HttpMethod.Put,url)) { request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var sItem = new Item { apikey =

How to search based on field in azure search?

强颜欢笑 提交于 2019-12-12 02:32:52
问题 i am using a azure search, and i have a console app with the code as below, which is working fine. DocumentSearchResult<Hotel> results; Console.WriteLine("Search started\n"); results = indexClient.Documents.Search<Hotel>("smart", new SearchParameters { Top=5 }); WriteDocuments(results); currently its searching a text with word "smart". this is straight forword, what i need is i have several fields in the table, i want to search based on the feild . for example let i have two fields 1)Title 2

How to create Index with custom analyzers from json file in Azure Search .NET SDK?

限于喜欢 提交于 2019-12-12 01:23:10
问题 I had read that the Azure Search .NET SDK uses NewtonSoft.Json to convert it's models to/from json in it's underlying REST API calls so I've been doing the same in my own app. I have a simple app which creates a new Index using the .NET SDK. To do this, I was defining my Index in a json file, using the format outlined here https://docs.microsoft.com/en-us/rest/api/searchservice/create-index and then I was converting this to a Microsoft.Azure.Search.Models.Index object using Newtonsoft. var

How to index a field with alphanumeric characters AND a dash for wildcard search

╄→гoц情女王★ 提交于 2019-12-11 17:57:20
问题 Given a model that looks like this: { [Key] public string Id { get; set; } [IsSearchable] [Analyzer(AnalyzerName.AsString.Keyword)] public string AccountId { get; set; } } And sample data for the AccountId that would look like this: 1-ABC123 1-333444555 1-A4KK498 The field can have any combination of letters/digits and a dash in the middle. I need to be able to search on this field using queries like 1-ABC*. However, none of the basic analyzers seem to support the dash except Keyword, which

Get actual count of matches in Azure Search

瘦欲@ 提交于 2019-12-11 16:09:54
问题 Azure Search returns a maximum of 1,000 results at a time. For paging on the client, I want the total count of matches in order to be able to display the correct number of paging buttons at the bottom and in order to be able to tell the user how many results there are. However, if there are over a thousand, how do I get the actual count? All I know is that there were at least 1,000 matches. I need to be able to do this from within the SDK. 回答1: If you want to get total number of documents in

Azure Search RetryPolicy

空扰寡人 提交于 2019-12-06 07:55:17
问题 We are using azure search and need to implement a retry stratgey as well as storing the Ids of failed documents as described. Is there any documentation/samples on how to implement a RetryPolicy strategy in Azure Search. Thanks 回答1: This is what I used: private async Task<DocumentIndexResult> IndexWithExponentialBackoffAsync(IndexBatch<IndexModel> indexBatch) { return await Policy .Handle<IndexBatchException>() .WaitAndRetryAsync(5, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2,

Azure Search RetryPolicy

让人想犯罪 __ 提交于 2019-12-04 14:28:29
We are using azure search and need to implement a retry stratgey as well as storing the Ids of failed documents as described. Is there any documentation/samples on how to implement a RetryPolicy strategy in Azure Search. Thanks This is what I used: private async Task<DocumentIndexResult> IndexWithExponentialBackoffAsync(IndexBatch<IndexModel> indexBatch) { return await Policy .Handle<IndexBatchException>() .WaitAndRetryAsync(5, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)), (ex, span) => { indexBatch = ((IndexBatchException)ex).FindFailedActionsToRetry(indexBatch, x => x.Id);