public async Task <IList <SearchResult> > SearchAsync(string searchText, int page) { var options = new Azure.Search.Documents.SearchOptions { SearchMode = SearchMode.All, HighlightPreTag = "<b>", HighlightPostTag = "</b>", Skip = (page - 1) * PageSize }; options.HighlightFields.Add("Name"); options.HighlightFields.Add("Description"); options.HighlightFields.Add("FacilityName"); options.HighlightFields.Add("FacilityDescription"); var result = await client.SearchAsync <Accommodation>(searchText, options); var items = result.Value.GetResults(); return(result.Value != null?mapper.MapFrom(items.ToArray()) : null); }
public virtual async Task <Response <SearchDocumentsResult> > SearchPostAsync(SearchOptions searchRequest, Guid?xMsClientRequestId = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("DocumentsClient.SearchPost"); scope.Start(); try { return(await RestClient.SearchPostAsync(searchRequest, xMsClientRequestId, cancellationToken).ConfigureAwait(false)); } catch (Exception e) { scope.Failed(e); throw; } }