public static async Task <CatalogSearchResult <T> > GetCatalogResultsAsync <T>(this IElasticSearchService <T> service) where T : EntryContentBase { service.UseIndex(GetIndexName(service.SearchLanguage)); SearchResult results = await service.GetResultsAsync(); return(GetCatalogSearchResult(service, results)); }
public static CatalogSearchResult <T> GetCatalogResults <T>(this IElasticSearchService <T> service) where T : EntryContentBase { service.SearchType = typeof(T); service.UseIndex(GetIndexName(service.SearchLanguage)); SearchResult results = service.GetResults(); var hits = new List <CatalogSearchHit <T> >(); foreach (SearchHit hit in results.Hits) { if (hit.ShouldAdd(false, out T content, new[] { ProviderConstants.CatalogProviderKey })) { hits.Add(new CatalogSearchHit <T>(content, hit.CustomProperties, hit.QueryScore, hit.Highlight)); }