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


C# Index.ParallelReader类代码示例

本文整理汇总了C#中Lucene.Net.Index.ParallelReader的典型用法代码示例。如果您正苦于以下问题:C# ParallelReader类的具体用法?C# ParallelReader怎么用?C# ParallelReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ParallelReader类属于Lucene.Net.Index命名空间,在下文中一共展示了ParallelReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestFieldNames

		public virtual void  TestFieldNames()
		{
			Directory dir1 = GetDir1();
			Directory dir2 = GetDir2();
			ParallelReader pr = new ParallelReader();
			pr.Add(IndexReader.Open(dir1));
			pr.Add(IndexReader.Open(dir2));
            System.Collections.Generic.ICollection<string> fieldNames = pr.GetFieldNames(IndexReader.FieldOption.ALL);
			Assert.AreEqual(4, fieldNames.Count);
			Assert.IsTrue(SupportClass.CollectionsHelper.Contains(fieldNames, "f1"));
			Assert.IsTrue(SupportClass.CollectionsHelper.Contains(fieldNames, "f2"));
			Assert.IsTrue(SupportClass.CollectionsHelper.Contains(fieldNames, "f3"));
			Assert.IsTrue(SupportClass.CollectionsHelper.Contains(fieldNames, "f4"));
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:14,代码来源:TestParallelReader.cs

示例2: Parallel

		// Fields 1 & 2 in one index, 3 & 4 in other, with ParallelReader:
		private Searcher Parallel()
		{
			Directory dir1 = GetDir1();
			Directory dir2 = GetDir2();
			ParallelReader pr = new ParallelReader();
			pr.Add(IndexReader.Open(dir1));
			pr.Add(IndexReader.Open(dir2));
			return new IndexSearcher(pr);
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:10,代码来源:TestParallelReader.cs

示例3: OpenReader

			protected internal override IndexReader OpenReader()
			{
				ParallelReader pr = new ParallelReader();
				pr.Add(IndexReader.Open(dir3));
				pr.Add(IndexReader.Open(dir4));
				pr.Add(new FilterIndexReader(IndexReader.Open(dir3)));
				return pr;
			}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:8,代码来源:TestIndexReaderReopen.cs

示例4: InitBlock

			private void  InitBlock(ParallelReader enclosingInstance)
			{
				this.enclosingInstance = enclosingInstance;
			}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:4,代码来源:ParallelReader.cs

示例5: ParallelTermDocs

			public ParallelTermDocs(ParallelReader enclosingInstance)
			{
				InitBlock(enclosingInstance);
			}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:4,代码来源:ParallelReader.cs

示例6: ParallelTermEnum

			public ParallelTermEnum(ParallelReader enclosingInstance)
			{
				InitBlock(enclosingInstance);
				try
				{
					field = ((System.String) Enclosing_Instance.fieldToReader.GetKey(0));
				}
				catch (ArgumentOutOfRangeException e)
				{
					// No fields, so keep field == null, termEnum == null
					return;
				}
				if (field != null)
					termEnum = ((IndexReader) Enclosing_Instance.fieldToReader[field]).Terms();
			}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:15,代码来源:ParallelReader.cs

示例7: 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

示例8: ParallelTermEnum

			public ParallelTermEnum(ParallelReader enclosingInstance)
			{
				InitBlock(enclosingInstance);
				try
				{
					field = Enclosing_Instance.fieldToReader.Keys.First();
				}
				catch (ArgumentOutOfRangeException)
				{
					// No fields, so keep field == null, termEnum == null
					return;
				}
				if (field != null)
					termEnum = Enclosing_Instance.fieldToReader[field].Terms();
			}
开发者ID:modulexcite,项目名称:Xamarin-Lucene.Net,代码行数:15,代码来源:ParallelReader.cs

示例9: ParallelTermDocs

			public ParallelTermDocs(ParallelReader enclosingInstance, Term term)
			{
				InitBlock(enclosingInstance);
				Seek(term);
			}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:5,代码来源:ParallelReader.cs

示例10: ParallelTermEnum

			public ParallelTermEnum(ParallelReader enclosingInstance, Term term)
			{
				InitBlock(enclosingInstance);
				field = term.Field();
				termEnum = ((IndexReader) Enclosing_Instance.fieldToReader[field]).Terms(term);
			}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:6,代码来源:ParallelReader.cs

示例11: TestIncompatibleIndexes

        public virtual void  TestIncompatibleIndexes()
        {
            // two documents:
            Directory dir1 = GetDir1();
            
            // one document only:
            Directory dir2 = new MockRAMDirectory();
            IndexWriter w2 = new IndexWriter(dir2, new StandardAnalyzer(Util.Version.LUCENE_CURRENT), true, IndexWriter.MaxFieldLength.LIMITED);
            Document d3 = new Document();
            d3.Add(new Field("f3", "v1", Field.Store.YES, Field.Index.ANALYZED));
            w2.AddDocument(d3);
            w2.Close();
            
            ParallelReader pr = new ParallelReader();
            pr.Add(IndexReader.Open(dir1, false));

            Assert.Throws<ArgumentException>(() => pr.Add(IndexReader.Open(dir2, false)),
                                                "didn't get exptected exception: indexes don't have same number of documents");
        }
开发者ID:Nangal,项目名称:lucene.net,代码行数:19,代码来源:TestParallelReader.cs

示例12: TestDocument

		public virtual void  TestDocument()
		{
			Directory dir1 = GetDir1();
			Directory dir2 = GetDir2();
			ParallelReader pr = new ParallelReader();
			pr.Add(IndexReader.Open(dir1));
			pr.Add(IndexReader.Open(dir2));
			
			Document doc11 = pr.Document(0, new MapFieldSelector(new System.String[]{"f1"}));
			Document doc24 = pr.Document(1, new MapFieldSelector(new System.Collections.ArrayList(new System.String[]{"f4"})));
			Document doc223 = pr.Document(1, new MapFieldSelector(new System.String[]{"f2", "f3"}));
			
			Assert.AreEqual(1, doc11.GetFields().Count);
			Assert.AreEqual(1, doc24.GetFields().Count);
			Assert.AreEqual(2, doc223.GetFields().Count);
			
			Assert.AreEqual("v1", doc11.Get("f1"));
			Assert.AreEqual("v2", doc24.Get("f4"));
			Assert.AreEqual("v2", doc223.Get("f2"));
			Assert.AreEqual("v2", doc223.Get("f3"));
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:21,代码来源:TestParallelReader.cs

示例13: TestReferenceCountingParallelReader

		public virtual void  TestReferenceCountingParallelReader()
		{
			for (int mode = 0; mode <= 1; mode++)
			{
				Directory dir1 = new MockRAMDirectory();
				CreateIndex(dir1, false);
				Directory dir2 = new MockRAMDirectory();
				CreateIndex(dir2, true);
				
				IndexReader reader1 = IndexReader.Open(dir1);
				AssertRefCountEquals(1, reader1);
				
				ParallelReader parallelReader1 = new ParallelReader(mode == 0);
				parallelReader1.Add(reader1);
				IndexReader initReader2 = IndexReader.Open(dir2);
				parallelReader1.Add(initReader2);
				ModifyIndex(1, dir2);
				AssertRefCountEquals(1 + mode, reader1);
				
				IndexReader parallelReader2 = parallelReader1.Reopen();
				// index1 hasn't changed, so parallelReader2 should share reader1 now with multiReader1
				AssertRefCountEquals(2 + mode, reader1);
				
				ModifyIndex(0, dir1);
				ModifyIndex(0, dir2);
				IndexReader reader2 = reader1.Reopen();
				AssertRefCountEquals(2 + mode, reader1);
				
				if (mode == 1)
				{
					initReader2.Close();
				}
				
				ModifyIndex(4, dir1);
				IndexReader reader3 = reader2.Reopen();
				AssertRefCountEquals(2 + mode, reader1);
				AssertRefCountEquals(1, reader2);
				
				parallelReader1.Close();
				AssertRefCountEquals(1 + mode, reader1);
				
				parallelReader1.Close();
				AssertRefCountEquals(1 + mode, reader1);
				
				if (mode == 1)
				{
					initReader2.Close();
				}
				
				reader1.Close();
				AssertRefCountEquals(1, reader1);
				
				parallelReader2.Close();
				AssertRefCountEquals(0, reader1);
				
				parallelReader2.Close();
				AssertRefCountEquals(0, reader1);
				
				reader3.Close();
				AssertRefCountEquals(0, reader1);
				AssertReaderClosed(reader1, true, false);
				
				reader2.Close();
				AssertRefCountEquals(0, reader1);
				AssertReaderClosed(reader1, true, false);
				
				reader2.Close();
				AssertRefCountEquals(0, reader1);
				
				reader3.Close();
				AssertRefCountEquals(0, reader1);
				AssertReaderClosed(reader1, true, true);
				
				dir1.Close();
				dir2.Close();
			}
		}
开发者ID:Mpdreamz,项目名称:lucene.net,代码行数:77,代码来源:TestIndexReaderReopen.cs

示例14: TestParallelReader

		public virtual void  TestParallelReader()
		{
			Directory dir1 = new MockRAMDirectory();
			TestIndexReaderReopen.CreateIndex(dir1, true);
			Directory dir2 = new MockRAMDirectory();
			TestIndexReaderReopen.CreateIndex(dir2, true);
			IndexReader r1 = IndexReader.Open(dir1, false);
            IndexReader r2 = IndexReader.Open(dir2, false);
			
			ParallelReader pr1 = new ParallelReader();
			pr1.Add(r1);
			pr1.Add(r2);
			
			PerformDefaultTests(pr1);
			pr1.Close();
			dir1.Close();
			dir2.Close();
		}
开发者ID:synhershko,项目名称:lucene.net,代码行数:18,代码来源:TestIndexReaderClone.cs

示例15: TestIncompatibleIndexes

		public virtual void  TestIncompatibleIndexes()
		{
			// two documents:
			Directory dir1 = GetDir1();
			
			// one document only:
			Directory dir2 = new MockRAMDirectory();
			IndexWriter w2 = new IndexWriter(dir2, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
			Document d3 = new Document();
			d3.Add(new Field("f3", "v1", Field.Store.YES, Field.Index.ANALYZED));
			w2.AddDocument(d3);
			w2.Close();
			
			ParallelReader pr = new ParallelReader();
			pr.Add(IndexReader.Open(dir1));
			try
			{
				pr.Add(IndexReader.Open(dir2));
				Assert.Fail("didn't get exptected exception: indexes don't have same number of documents");
			}
			catch (System.ArgumentException e)
			{
				// expected exception
			}
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:25,代码来源:TestParallelReader.cs


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