本文整理汇总了C#中Lucene.Net.Index.IndexWriter.SetMergedSegmentWarmer方法的典型用法代码示例。如果您正苦于以下问题:C# IndexWriter.SetMergedSegmentWarmer方法的具体用法?C# IndexWriter.SetMergedSegmentWarmer怎么用?C# IndexWriter.SetMergedSegmentWarmer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lucene.Net.Index.IndexWriter
的用法示例。
在下文中一共展示了IndexWriter.SetMergedSegmentWarmer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestMergeWarmer
public virtual void TestMergeWarmer()
{
Directory dir1 = new MockRAMDirectory();
IndexWriter writer = new IndexWriter(dir1, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.LIMITED);
writer.SetInfoStream(infoStream);
// create the index
CreateIndexNoClose(false, "test", writer);
// get a reader to put writer into near real-time mode
IndexReader r1 = writer.GetReader();
// Enroll warmer
MyWarmer warmer = new MyWarmer();
writer.SetMergedSegmentWarmer(warmer);
writer.SetMergeFactor(2);
writer.SetMaxBufferedDocs(2);
for (int i = 0; i < 10; i++)
{
writer.AddDocument(CreateDocument(i, "test", 4));
}
((ConcurrentMergeScheduler) writer.GetMergeScheduler()).Sync();
Assert.IsTrue(warmer.warmCount > 0);
int count = warmer.warmCount;
writer.AddDocument(CreateDocument(17, "test", 4));
writer.Optimize();
Assert.IsTrue(warmer.warmCount > count);
writer.Close();
r1.Close();
dir1.Close();
}
示例2: TestSegmentWarmer
public void TestSegmentWarmer()
{
Directory dir = new MockRAMDirectory();
IndexWriter w = new IndexWriter(dir, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.UNLIMITED);
w.SetMaxBufferedDocs(2);
w.GetReader().Close();
w.SetMergedSegmentWarmer(new AnonymousIndexReaderWarmer());
Document doc = new Document();
doc.Add(new Field("foo", "bar", Field.Store.YES, Field.Index.NOT_ANALYZED));
for (int i = 0; i < 20; i++)
{
w.AddDocument(doc);
}
w.WaitForMerges();
w.Close();
dir.Close();
}