public AddWord ( string word, int freq, string tag = null ) : void | ||
word | string | |
freq | int | |
tag | string | |
Résultat | void |
/// <summary> /// 创建索引 /// </summary> /// <returns></returns> public ActionResult CreateIndex() { var seg = new JiebaSegmenter(); seg.AddWord("Bolg"); BlogSearcher.ClearLuceneIndex(); Stopwatch st = new Stopwatch();//实例化类 st.Start();//开始计时 var data = bllSession.IArticleBLL.GetList(""); BlogSearcher.UpdateLuceneIndex(data); st.Stop();//终止计时 System.Diagnostics.Debug.WriteLine("执行时间:" + st.ElapsedMilliseconds); return Redirect("/Test/BlogSearchTest"); }
private static void TestNewsData() { var seg = new JiebaSegmenter(); seg.AddWord("机器学习"); NewsSearcher.ClearLuceneIndex(); var data = NewsRepository.GetAll(); NewsSearcher.UpdateLuceneIndex(data); var results = NewsSearcher.Search("进"); foreach (var result in results) { Console.WriteLine(result); } }
public ActionResult TestSearch() { var seg = new JiebaSegmenter(); seg.AddWord("机器学习"); NewsSearcher.ClearLuceneIndex(); var data = NewsRepository.GetAll(); NewsSearcher.UpdateLuceneIndex(data); var results = NewsSearcher.Search("方法研究"); return View(results); }