C# Lucene.net HTML文档示例,使用HTML字符串而不是文件?
我正在做一个网络爬虫,我想使用lucene在流媒体进行或完成时进行索引 我已经看到lucene.net html库的示例很好。然而,我不想继续下载到磁盘上。我想要的是在下载网页时建立索引,或者可能是建立一系列html内容的索引 有没有任何例子可以让lucence.net html indexer使用内存流或字符串?类似的东西C# Lucene.net HTML文档示例,使用HTML字符串而不是文件?,c#,string,memory-management,lucene.net,C#,String,Memory Management,Lucene.net,我正在做一个网络爬虫,我想使用lucene在流媒体进行或完成时进行索引 我已经看到lucene.net html库的示例很好。然而,我不想继续下载到磁盘上。我想要的是在下载网页时建立索引,或者可能是建立一系列html内容的索引 有没有任何例子可以让lucence.net html indexer使用内存流或字符串?类似的东西 // create writer to index IndexWriter iw = new IndexWriter(new FileInf
// create writer to index
IndexWriter iw = new IndexWriter(new FileInfo("C:\\example\\"), new StandardAnalyzer());
// create a document to index
Document d = new Document();
// create a field that the document will contain
Field aField = new Field("test", "", Field.Store.YES, Field.Index.ANALYZED);
// add the field to the document
d.Add(aField);
// index some data (4 documents)
aField.SetValue("Example 1");
iw.AddDocument(d);
aField.SetValue("Example 2");
iw.AddDocument(d);
aField.SetValue("Example 3");
iw.AddDocument(d);
aField.SetValue("Example 4");
// a field with Store.NO can be set with a TextReader
Field notStored = new Field("test2", "", Field.Store.NO, Field.Index.ANALYZED);
notStored.SetValue(new StringReader("Example 4 - From TextReader"));
// add new field to a 4th document
d.Add(notStored);
iw.AddDocument(d);
// closing writer commits changes to disk
iw.Close();