public override IEnumerable <SearchResult> Search(Query query) { var contentSearchHits = new List <ContentSearchHit <TContentData> >(); CultureInfo language = Language.GetRequestLanguage(); if (!query.SearchRoots.Any() || ForceRootLookup) { query.SearchRoots = new[] { GetSearchRoot() }; } foreach (string searchRoot in query.SearchRoots) { if (!Int32.TryParse(searchRoot, out int searchRootId) && searchRoot.Contains("__")) { Int32.TryParse(searchRoot.Split(new[] { "__" }, StringSplitOptions.None)[0], out searchRootId); } if (searchRootId != 0) { IElasticSearchService <TContentData> searchQuery = CreateQuery(query, language, searchRootId); ContentSearchResult <TContentData> contentSearchResult = searchQuery.GetContentResults(false, true, GetProviderKeys(), false, false); contentSearchHits.AddRange(contentSearchResult.Hits); } } return (contentSearchHits.OrderByDescending(hit => hit.Score) .Take(_elasticSearchSettings.ProviderMaxResults) .Select(hit => CreateSearchResult(hit.Content))); }
public static ContentSearchResult <T> GetContentResults <T>(this IElasticSearchService <T> service, bool requirePageTemplate, string[] providerNames) where T : IContentData => service.GetContentResults(requirePageTemplate, ignoreFilters : false, providerNames, enableHighlighting : true, enableDidYouMean : true);
public static ContentSearchResult <T> GetContentResults <T>(this IElasticSearchService <T> service, bool requirePageTemplate) where T : IContentData => service.GetContentResults(requirePageTemplate, new string[0]);
public static ContentSearchResult <T> GetContentResults <T>(this IElasticSearchService <T> service) where T : IContentData => service.GetContentResults(false, new string[0]);
public static ContentSearchResult <T> GetContentResults <T>(this IElasticSearchService <T> service, bool requirePageTemplate, string[] providerNames) where T : IContentData => service.GetContentResults(requirePageTemplate, false, providerNames, true, true);
public static ContentSearchResult <T> GetContentResults <T>( this IElasticSearchService <T> service) where T : IContentData { return(service.GetContentResults(false, null)); }
public static ContentSearchResult <T> GetContentResults <T>( this IElasticSearchService <T> service, bool requirePageTemplate) where T : IContentData { return(service.GetContentResults(requirePageTemplate, null)); }