本文整理汇总了C#中ISearchService.MarkTopicAsIndexed方法的典型用法代码示例。如果您正苦于以下问题:C# ISearchService.MarkTopicAsIndexed方法的具体用法?C# ISearchService.MarkTopicAsIndexed怎么用?C# ISearchService.MarkTopicAsIndexed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISearchService
的用法示例。
在下文中一共展示了ISearchService.MarkTopicAsIndexed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoIndex
public void DoIndex(ISearchService searchService, ISettingsManager settingsManager, IPostService postService)
{
var topic = searchService.GetNextTopicForIndexing();
if (topic != null)
{
searchService.MarkTopicAsIndexed(topic);
searchService.DeleteAllIndexedWordsForTopic(topic);
var junkList = searchService.GetJunkWords();
var wordList = new List<SearchWord>();
var alphaNum = SearchService.SearchWordPattern;
var posts = postService.GetPosts(topic, false);
foreach (var post in posts)
{
var firstPostMultiplier = 1;
if (post.IsFirstInTopic) firstPostMultiplier = 2;
var postWords = post.FullText.Split(new[] { " ", "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
if (postWords.Length > 0)
{
for (var x = 0; x < postWords.Length; x++)
{
foreach (Match match in alphaNum.Matches(postWords[x]))
{
TestForIndex(topic, match.Value, 1, firstPostMultiplier, true, wordList, junkList);
}
}
}
// index the name
foreach (Match match in alphaNum.Matches(post.Name))
{
TestForIndex(topic, match.Value, 2, firstPostMultiplier, false, wordList, junkList);
}
}
// bonus for appearing in title
foreach (Match match in alphaNum.Matches(topic.Title))
{
TestForIndex(topic, match.Value, 20, 1, false, wordList, junkList);
}
foreach (var word in wordList)
{
searchService.SaveSearchWord(word);
}
}
}