当前位置: 首页>>代码示例>>C#>>正文


C# ParallelReader.TermDocs方法代码示例

本文整理汇总了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());
//.........这里部分代码省略.........
开发者ID:synhershko,项目名称:lucene.net,代码行数:101,代码来源:TestParallelTermEnum.cs

示例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();
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:20,代码来源:TestParallelReader.cs


注:本文中的Lucene.Net.Index.ParallelReader.TermDocs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。