protected async Task <DocumentSearchResult <T> > WildcardSearch(string searchPhrase, SearchParameters searchParameters) { var wildcardSearchQuery = $"/.*{searchPhrase}.*/"; var client = await SearchIndexClientProvider.Get <T>(); searchParameters.QueryType = QueryType.Full; var searchResults = await client.Documents.SearchAsync <T>(wildcardSearchQuery, searchParameters); return(searchResults); }
protected async Task <IResult> Index(T value, IndexType indexType) { var indexClient = await _searchIndexClientProvider.Get <T>(indexType); var batch = IndexBatch.MergeOrUpload <T>(new List <T> { value }); try { await indexClient.Documents.IndexAsync <T>(batch); return(new SuccessfulResult()); } catch (IndexBatchException) { _logger.LogError($"Indexing failed for ${value.Id} in index {indexClient.IndexName}"); return(new FailedResult()); } }
protected async Task Index(T value) { var indexClient = await _searchIndexClientProvider.Get <T>(); var batch = IndexBatch.MergeOrUpload <T>(new List <T> { value }); try { await indexClient.Documents.IndexAsync <T>(batch); } catch (IndexBatchException) { _logger.LogError($"Indexing failed for ${value.Id} in index {indexClient.IndexName}"); } }