Dictionary <string, int> GetKeywordsRankList(DemoPageSection model)
        {
            if (!KeywordsRankList.ContainsKey(model))
            {
                List <TextRank> textRanks = new List <TextRank>();

                var rootPage = model as DemoRootPage;
                var page     = model as DemoPage;

                if (rootPage != null)
                {
                    textRanks.Add(new TextRank(rootPage.Title, 15));
                    textRanks.Add(new TextRank(rootPage.Id, 7));
                    textRanks.Add(new TextRank(rootPage.SeoTitle, 5));
                    textRanks.Add(new TextRank(rootPage.Keywords, 3));
                }
                else if (page != null)
                {
                    textRanks.Add(new TextRank(page.Title, 5));
                    textRanks.Add(new TextRank(page.Id, 3));
                    textRanks.Add(new TextRank(page.Keywords, 3));
                    textRanks.Add(new TextRank(page.SeoTitle, 2));
                }
                else
                {
                    textRanks.Add(new TextRank(model.Title, 5));
                    textRanks.Add(new TextRank(model.Id, 3));
                }
                KeywordsRankList.Add(model, SearchAgregator.GetKeywordsRankList(textRanks));
            }
            return(KeywordsRankList[model]);
        }
        public List <DemoSearchResult> DoSearch(string request)
        {
            var results = new List <DemoSearchResult>();

            if (!string.IsNullOrEmpty(request))
            {
                var requests = SearchAgregator.SplitRequests(request);
                try {
                    foreach (var rootPage in RootPages)
                    {
                        results.AddRange(DoSearch(requests, rootPage));
                    }
                }
                catch {
                }
                results = results.OrderByDescending(sr => sr.Rank).ToList();
            }
            return(results);
        }