|
Lucene.net 实现全文搜索(5) { doc.Add(Field.UnStored("text", parseHtml(html))); } else { doc.Add (Field .UnStored ("text",html)); } doc.Add(Field.Keyword("path", relativePath)); //doc.Add(Field.Text("title", getTitle(html))); doc.Add (Field .Text ("title",title)); writer.AddDocument(doc); } /**//// <summary> /// 去除网页中的标签 /// </summary> /// <param name="html">网页</param> /// <returns>返回去除后的网页文本</returns> private string parseHtml(string html) { string temp = Regex.Replace(html, "<[^>]*>", ""); return temp.Replace(" ", " "); } /**//// <summary>
|