BlogEngine.Core/Search.cs
(开头部分) 14KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
#region Using
using System;
using System.IO;
using System.Text;
using System.Web;
using System.Xml;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Collections.Specialized;
using BlogEngine.Core;
using System.Text.RegularExpressions;
#endregion
namespace BlogEngine.Core
{
/// <summary>
/// Searches the post collection and returns a result based on a search term.
/// <remarks>It is used for related posts and the in-site search feature.</remarks>
/// </summary>
public static class Search
{
static Search()
{
BuildCatalog();
Post.Saved += new EventHandler<SavedEventArgs>(Post_Saved);
Page.Saved += new EventHandler<SavedEventArgs>(Page_Saved);
BlogSettings.Changed += delegate { BuildCatalog(); };
Post.CommentAdded += new EventHandler<EventArgs>(Post_CommentAdded);
Post.CommentRemoved += delegate { BuildCatalog(); };
Comment.Approved += new EventHandler<EventArgs>(Post_CommentAdded);
}
#region Event handlers
/// <summary>
/// Adds a post to the catalog when it is added.
/// </summary>
private static void Post_Saved(object sender, SavedEventArgs e)
{
lock (_SyncRoot)
{
if (e.Action == SaveAction.Insert)
{
AddItem(sender as Post);
}
else
{
BuildCatalog();
}
}
}
private static void Page_Saved(object sender, SavedEventArgs e)
{
lock (_SyncRoot)
{
if (e.Action == SaveAction.Insert)
后面还有 485 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
