当前位置: 首页>>代码示例>>C#>>正文


C# ISearchService.GetNextTopicForIndexing方法代码示例

本文整理汇总了C#中ISearchService.GetNextTopicForIndexing方法的典型用法代码示例。如果您正苦于以下问题:C# ISearchService.GetNextTopicForIndexing方法的具体用法?C# ISearchService.GetNextTopicForIndexing怎么用?C# ISearchService.GetNextTopicForIndexing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISearchService的用法示例。


在下文中一共展示了ISearchService.GetNextTopicForIndexing方法的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);
				}
			}
		}
开发者ID:andyliyuze,项目名称:POPForums,代码行数:48,代码来源:SearchIndexWorker.cs


注:本文中的ISearchService.GetNextTopicForIndexing方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。