Community Server-->搜索处理

本模块目前只提供数据库搜索,暂不支持静态页面搜索。

这部分包括9部分:

CommunityComponents.IJob 提供从Xml节点执行方法的接口。

Search       提供搜索引擎。

.CommunityComponents.SearchJob       提供查询任务。

CommunityComponents.SearchQuery    提供查询条件。

CommunityComponents.Word            提供查询词的定义。

WordLocation     提供查询词所处位置。

CommunityComponents.PostSet              提供帖子以及回复集合。

CommunityComponents.SearchResultSet   提供查询集合。

 

1.1    执行任务接口 

void Execute(XmlNode node);定义所有执行任务执行此方法,并传入XML节点数据。

1.2    提供搜索引擎

抽象方法:

abstract void IndexPosts (int setSize, int settingsID);执行对帖子建立索引。

abstract double CalculateWordRank (Word word, Post post, int totalBodyWords);

计算此词的排名。

abstract SearchResultSet GetSearchResults (SearchQuery query, SearchTerms terms);

获取查询结果集合

abstract ArrayList GetPermissionFilterList();获取权限过滤列表。

virtual SearchResultSet GetSearchResults(SearchQuery query)根据传入查询,指定SectionsToFilterGetPermissionFilterList(),并调用分词方法GetSearchTerms(),返回查询结果集合。

InsertIntoSearchBarrel(Hashtable words, Post post, int settingsID, int totalBodyWords),将此词的排名进行计算,并插入数据库。

static Hashtable GetIgnoreWords (int settingsID):提供该配置下的所有过滤词,并进行缓存。

static string[] CleanSearchTerms(string searchTerms):移除传入查询条件中的所有非法字符,并返回干净字符串数组。

static Hashtable Index (string contentToIndex, Hashtable words, WordLocation wordLocation, int settingsID)对建立索引的内容contentToIndex执行方法CleanSearchTerms,通过词的散列编码与过滤词的散列编码比较,如果不同,则判断是否传入词表words是否已包含该词,来觉得累加还是新建词。

 

 

1.3    提供查询任务

用于后台线程为当前查询下的帖子执行索引服务,此执行方法执行接口Ijob

1.4    提供查询条件

GroupToSearch:组过滤,SectionsToSearch:章节过滤,UsersToSearch:用户过滤,SectionsToFilter:章节过滤条件,SearchTerms:查询分词。PageIndex:定义取那页,PageSize:定义每页大小。

static SearchQuery FirstPageQuery(string textToFind)定义第一次查询方法,textToFind为查询条件SearchTerms

static SearchQuery SectionSearch(string textToFind, int SectionID)定义从那一章节条件为textToFind的查询。

1.5    提供查询连接词

string[] And:定义所有And连接的条件,string[] Or:定义所有OR连接的条件。

HasTerms:判断此查询是否存在And或者Or的条件。

1.6    提供查询词的定义

对于检索词的定义

Occurrence 出现频率,word 此词名称,_occurenceWeight此词权重,权重根据此词所处位置划分了不同的比例因子。

1.7    提供查询词所处位置

此枚举目前提供如下位置:

Section:章节,Excerpt:摘要(简要说明处),Subject:标题,Body:正文,Author:作者。

1.8    提供帖子以及回复集合

Posts:所有的帖子集合(发贴和回帖总数), Replies:所有的回帖,ThreadStarter:当前发贴Post

bool HasResults:是否存在帖子。

int TotalRecords:总共记录数。

1.9    提供查询集合

继承PostSet,并提供查询所耗用的时间精确到毫秒SearchDuration

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值