IEnumerable <DemoSearchResult> DoSearch(List <string[]> requests, DemoRootPage rootPage)
        {
            var results = new List <DemoSearchResult>();

            foreach (var page in rootPage.Pages)
            {
                int resultCount = results.Count;
                foreach (var section in page.PageSections)
                {
                    results.AddRange(GetRes(requests, page, section, DemoSearchAgregator.HighlightOccurences(section.Title, requests)));
                }
                if (results.Count == resultCount)
                {
                    results.AddRange(GetRes(requests, page, null, DemoSearchAgregator.HighlightOccurences(page.Title, requests)));
                }
            }
            results.AddRange(GetRes(requests, rootPage, null, DemoSearchAgregator.HighlightOccurences(rootPage.Title, requests)));
            return(results);
        }
Exemple #2
0
 public static string GetRootDemoPageUrl(DemoRootPage rootPage)
 {
     return(!string.IsNullOrEmpty(rootPage.Url) ? rootPage.Url : rootPage.Pages.Select(p => p.Url).FirstOrDefault());
 }