Exemplo n.º 1
0
        // ISEARCHDYNAMICURLS
        // ISEARCHDYNAMICURLS
        // ISEARCHDYNAMICURLS

        public async Task KeywordsForDynamicUrlsAsync(ISearchWords searchWords)
        {
            using (this) {
                BlogConfigData config = await BlogConfigDataProvider.GetConfigAsync();

                List <DataProviderFilterInfo> filters = DataProviderFilterInfo.Join(null, new DataProviderFilterInfo {
                    Field = nameof(BlogEntry.Published), Operator = "==", Value = true
                });
                DataProviderGetRecords <BlogEntry> entries = await GetItemsAsync(0, 0, null, filters);

                foreach (BlogEntry entry in entries.Data)
                {
                    string url = await BlogConfigData.GetEntryCanonicalNameAsync(entry.Identity);

                    PageDefinition page = await PageDefinition.LoadFromUrlAsync(url);

                    if (page == null)
                    {
                        return;               // there is no such root page
                    }
                    if (!searchWords.WantPage(page))
                    {
                        return;
                    }

                    if (await searchWords.SetUrlAsync(url, page.PageSecurity, entry.Title, entry.DisplayableSummaryText, entry.DateCreated, entry.DateUpdated, page.IsAuthorized_View_Anonymous(), page.IsAuthorized_View_AnyUser()))
                    {
                        searchWords.AddObjectContents(entry);
                        using (BlogCommentDataProvider commentDP = new BlogCommentDataProvider(entry.Identity)) {
                            DataProviderGetRecords <BlogComment> comments = await commentDP.GetItemsAsync(0, 0, null, null);

                            foreach (BlogComment comment in comments.Data)
                            {
                                searchWords.AddObjectContents(comment);
                            }
                        }
                        await searchWords.SaveAsync();
                    }
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WordSearchManager"/> class.
 /// </summary>
 /// <param name="directoriesLoader">The directories loader.</param>
 /// <param name="wordSearcher">The word searcher.</param>
 public WordSearchManager(ILoadDirectories directoriesLoader, ISearchWords wordSearcher)
 {
     this.directoriesLoader = directoriesLoader;
     this.wordSearcher      = wordSearcher;
 }
Exemplo n.º 3
0
        // SEARCH
        // SEARCH
        // SEARCH

        public override void CustomSearch(ISearchWords searchWords)
        {
            searchWords.AddObjectContents(Contents);
        }
Exemplo n.º 4
0
        // SEARCH
        // SEARCH
        // SEARCH

        public override void CustomSearch(ISearchWords searchWords)
        {
            searchWords.AddContent(CompleteContents);
        }