本文整理汇总了C#中Lucene.Net.Index.ParallelReader.TermDocs方法的典型用法代码示例。如果您正苦于以下问题:C# ParallelReader.TermDocs方法的具体用法?C# ParallelReader.TermDocs怎么用?C# ParallelReader.TermDocs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lucene.Net.Index.ParallelReader
的用法示例。
在下文中一共展示了ParallelReader.TermDocs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test1
public virtual void Test1()
{
ParallelReader pr = new ParallelReader();
pr.Add(ir1);
pr.Add(ir2);
TermDocs td = pr.TermDocs();
TermEnum te = pr.Terms();
Assert.IsTrue(te.Next());
Assert.AreEqual("field1:brown", te.Term.ToString());
td.Seek(te.Term);
Assert.IsTrue(td.Next());
Assert.AreEqual(0, td.Doc);
Assert.IsFalse(td.Next());
Assert.IsTrue(te.Next());
Assert.AreEqual("field1:fox", te.Term.ToString());
td.Seek(te.Term);
Assert.IsTrue(td.Next());
Assert.AreEqual(0, td.Doc);
Assert.IsFalse(td.Next());
Assert.IsTrue(te.Next());
Assert.AreEqual("field1:jumps", te.Term.ToString());
td.Seek(te.Term);
Assert.IsTrue(td.Next());
Assert.AreEqual(0, td.Doc);
Assert.IsFalse(td.Next());
Assert.IsTrue(te.Next());
Assert.AreEqual("field1:quick", te.Term.ToString());
td.Seek(te.Term);
Assert.IsTrue(td.Next());
Assert.AreEqual(0, td.Doc);
Assert.IsFalse(td.Next());
Assert.IsTrue(te.Next());
Assert.AreEqual("field1:the", te.Term.ToString());
td.Seek(te.Term);
Assert.IsTrue(td.Next());
Assert.AreEqual(0, td.Doc);
Assert.IsFalse(td.Next());
Assert.IsTrue(te.Next());
Assert.AreEqual("field2:brown", te.Term.ToString());
td.Seek(te.Term);
Assert.IsTrue(td.Next());
Assert.AreEqual(0, td.Doc);
Assert.IsFalse(td.Next());
Assert.IsTrue(te.Next());
Assert.AreEqual("field2:fox", te.Term.ToString());
td.Seek(te.Term);
Assert.IsTrue(td.Next());
Assert.AreEqual(0, td.Doc);
Assert.IsFalse(td.Next());
Assert.IsTrue(te.Next());
Assert.AreEqual("field2:jumps", te.Term.ToString());
td.Seek(te.Term);
Assert.IsTrue(td.Next());
Assert.AreEqual(0, td.Doc);
Assert.IsFalse(td.Next());
Assert.IsTrue(te.Next());
Assert.AreEqual("field2:quick", te.Term.ToString());
td.Seek(te.Term);
Assert.IsTrue(td.Next());
Assert.AreEqual(0, td.Doc);
Assert.IsFalse(td.Next());
Assert.IsTrue(te.Next());
Assert.AreEqual("field2:the", te.Term.ToString());
td.Seek(te.Term);
Assert.IsTrue(td.Next());
Assert.AreEqual(0, td.Doc);
Assert.IsFalse(td.Next());
Assert.IsTrue(te.Next());
Assert.AreEqual("field3:dog", te.Term.ToString());
td.Seek(te.Term);
Assert.IsTrue(td.Next());
Assert.AreEqual(0, td.Doc);
Assert.IsFalse(td.Next());
Assert.IsTrue(te.Next());
Assert.AreEqual("field3:fox", te.Term.ToString());
td.Seek(te.Term);
Assert.IsTrue(td.Next());
Assert.AreEqual(0, td.Doc);
Assert.IsFalse(td.Next());
Assert.IsTrue(te.Next());
Assert.AreEqual("field3:jumps", te.Term.ToString());
td.Seek(te.Term);
Assert.IsTrue(td.Next());
Assert.AreEqual(0, td.Doc);
Assert.IsFalse(td.Next());
Assert.IsTrue(te.Next());
Assert.AreEqual("field3:lazy", te.Term.ToString());
td.Seek(te.Term);
Assert.IsTrue(td.Next());
Assert.AreEqual(0, td.Doc);
Assert.IsFalse(td.Next());
Assert.IsTrue(te.Next());
Assert.AreEqual("field3:over", te.Term.ToString());
td.Seek(te.Term);
Assert.IsTrue(td.Next());
Assert.AreEqual(0, td.Doc);
Assert.IsFalse(td.Next());
Assert.IsTrue(te.Next());
//.........这里部分代码省略.........
示例2: TestAllTermDocs
public virtual void TestAllTermDocs()
{
Directory dir1 = GetDir1();
Directory dir2 = GetDir2();
ParallelReader pr = new ParallelReader();
pr.Add(IndexReader.Open(dir1));
pr.Add(IndexReader.Open(dir2));
int NUM_DOCS = 2;
TermDocs td = pr.TermDocs(null);
for (int i = 0; i < NUM_DOCS; i++)
{
Assert.IsTrue(td.Next());
Assert.AreEqual(i, td.Doc());
Assert.AreEqual(1, td.Freq());
}
td.Close();
pr.Close();
dir1.Close();
dir2.Close();
}