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


C# Index.SegmentReader类代码示例

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


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

示例1: SetUp

		public override void  SetUp()
		{
			base.SetUp();
			DocHelper.SetupDoc(testDoc);
			SegmentInfo info = DocHelper.WriteDoc(dir, testDoc);
			reader = SegmentReader.Get(info);
		}
开发者ID:Rationalle,项目名称:ravendb,代码行数:7,代码来源:TestSegmentReader.cs

示例2: TestBadSeek

		public virtual void  TestBadSeek()
		{
			try
			{
				//After adding the document, we should be able to read it back in
				SegmentReader reader = new SegmentReader(new SegmentInfo("test", 3, dir));
				Assert.IsTrue(reader != null);
				SegmentTermDocs segTermDocs = new SegmentTermDocs(reader);
				Assert.IsTrue(segTermDocs != null);
				segTermDocs.Seek(new Term("textField2", "bad"));
				Assert.IsTrue(segTermDocs.Next() == false);
				reader.Close();
			}
			catch (System.IO.IOException e)
			{
				Assert.IsTrue(false);
			}
			try
			{
				//After adding the document, we should be able to read it back in
				SegmentReader reader = new SegmentReader(new SegmentInfo("test", 3, dir));
				Assert.IsTrue(reader != null);
				SegmentTermDocs segTermDocs = new SegmentTermDocs(reader);
				Assert.IsTrue(segTermDocs != null);
				segTermDocs.Seek(new Term("junk", "bad"));
				Assert.IsTrue(segTermDocs.Next() == false);
				reader.Close();
			}
			catch (System.IO.IOException e)
			{
				Assert.IsTrue(false);
			}
		}
开发者ID:runefs,项目名称:Marvin,代码行数:33,代码来源:TestSegmentTermDocs.cs

示例3: DoBody

 protected internal override object DoBody(string segmentFileName)
 {
     var sis = new SegmentInfos();
     sis.Read(directory, segmentFileName);
     var readers = new SegmentReader[sis.Size()];
     for (int i = sis.Size() - 1; i >= 0; i--)
     {
         System.IO.IOException prior = null;
         bool success = false;
         try
         {
             readers[i] = new SegmentReader(sis.Info(i), termInfosIndexDivisor, IOContext.READ);
             success = true;
         }
         catch (System.IO.IOException ex)
         {
             prior = ex;
         }
         finally
         {
             if (!success)
             {
                 IOUtils.CloseWhileHandlingException(prior, readers);
             }
         }
     }
     return new StandardDirectoryReader(directory, readers, null, sis, termInfosIndexDivisor, false);
 }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:28,代码来源:StandardDirectoryReader.cs

示例4: Norm

			public Norm(SegmentReader enclosingInstance, IndexInput in_Renamed, int number, long normSeek)
			{
				InitBlock(enclosingInstance);
				this.in_Renamed = in_Renamed;
				this.number = number;
				this.normSeek = normSeek;
			}
开发者ID:zweib730,项目名称:beagrep,代码行数:7,代码来源:SegmentReader.cs

示例5: CreateOpenBitSets

        static void CreateOpenBitSets(SegmentReader reader, IDictionary<string, HashSet<string>> feeds, IDictionary<string, IDictionary<string, OpenBitSet>> bitSetLookup)
        {
            for (int n = 0; n < reader.MaxDoc; n++)
            {
                if (reader.IsDeleted(n))
                {
                    continue;
                }

                Document document = reader.Document(n);

                string id = document.Get("Id");

                if (id == null)
                {
                    continue;
                }

                foreach (var feed in feeds)
                {
                    if (feed.Value.Contains(id))
                    {
                        bitSetLookup[feed.Key][reader.SegmentName].Set(n);
                    }
                }
            }
        }
开发者ID:jinujoseph,项目名称:NuGet.Services.Metadata,代码行数:27,代码来源:CuratedFeedFilter.cs

示例6: AllTermDocs

		protected internal AllTermDocs(SegmentReader parent) : base(parent.MaxDoc)
		{
			lock (parent)
			{
				this.deletedDocs = parent.deletedDocs;
			}
		}
开发者ID:modulexcite,项目名称:Xamarin-Lucene.Net,代码行数:7,代码来源:AllTermDocs.cs

示例7: SegmentTermDocs

		public SegmentTermDocs(SegmentReader parent)
		{
			this.parent = parent;
			this.freqStream = (IndexInput) parent.freqStream.Clone();
			this.deletedDocs = parent.deletedDocs;
			this.skipInterval = parent.tis.GetSkipInterval();
		}
开发者ID:zweib730,项目名称:beagrep,代码行数:7,代码来源:SegmentTermDocs.cs

示例8: TestDocument

        public virtual void TestDocument()
        {
            SegmentReader[] readers = new SegmentReader[2];
            Directory dir = NewDirectory();
            Document doc1 = new Document();
            Document doc2 = new Document();
            DocHelper.SetupDoc(doc1);
            DocHelper.SetupDoc(doc2);
            DocHelper.WriteDoc(Random(), dir, doc1);
            DocHelper.WriteDoc(Random(), dir, doc2);
            DirectoryReader reader = DirectoryReader.Open(dir);
            Assert.IsTrue(reader != null);
            Assert.IsTrue(reader is StandardDirectoryReader);

            Document newDoc1 = reader.Document(0);
            Assert.IsTrue(newDoc1 != null);
            Assert.IsTrue(DocHelper.NumFields(newDoc1) == DocHelper.NumFields(doc1) - DocHelper.Unstored.Count);
            Document newDoc2 = reader.Document(1);
            Assert.IsTrue(newDoc2 != null);
            Assert.IsTrue(DocHelper.NumFields(newDoc2) == DocHelper.NumFields(doc2) - DocHelper.Unstored.Count);
            Terms vector = reader.GetTermVectors(0).Terms(DocHelper.TEXT_FIELD_2_KEY);
            Assert.IsNotNull(vector);

            reader.Dispose();
            if (readers[0] != null)
            {
                readers[0].Dispose();
            }
            if (readers[1] != null)
            {
                readers[1].Dispose();
            }
            dir.Dispose();
        }
开发者ID:paulirwin,项目名称:lucene.net,代码行数:34,代码来源:TestDirectoryReader.cs

示例9: SetUp

 public override void  SetUp()
 {
     base.SetUp();
     DocHelper.SetupDoc(testDoc);
     SegmentInfo info = DocHelper.WriteDoc(dir, testDoc);
     reader = SegmentReader.Get(true, info, IndexReader.DEFAULT_TERMS_INDEX_DIVISOR);
 }
开发者ID:Nangal,项目名称:lucene.net,代码行数:7,代码来源:TestSegmentReader.cs

示例10: MultiSegmentReader

        private int[] starts; // 1st docno for each segment

        #endregion Fields

        #region Constructors

        /// <summary>Construct reading the named set of readers. </summary>
        internal MultiSegmentReader(Directory directory, SegmentInfos sis, bool closeDirectory, bool readOnly)
            : base(directory, sis, closeDirectory, readOnly)
        {
            // To reduce the chance of hitting FileNotFound
            // (and having to retry), we open segments in
            // reverse because IndexWriter merges & deletes
            // the newest segments first.

            SegmentReader[] readers = new SegmentReader[sis.Count];
            for (int i = sis.Count - 1; i >= 0; i--)
            {
                try
                {
                    readers[i] = SegmentReader.Get(readOnly, sis.Info(i));
                }
                catch (System.IO.IOException e)
                {
                    // Close all readers we had opened:
                    for (i++; i < sis.Count; i++)
                    {
                        try
                        {
                            readers[i].Close();
                        }
                        catch (System.IO.IOException)
                        {
                            // keep going - we want to clean up as much as possible
                        }
                    }
                    throw e;
                }
            }

            Initialize(readers);
        }
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:42,代码来源:MultiSegmentReader.cs

示例11: AllTermDocs

 protected internal AllTermDocs(SegmentReader parent)
 {
     lock (parent)
     {
         this.deletedDocs = parent.deletedDocs;
     }
     this.maxDoc = parent.MaxDoc();
 }
开发者ID:andylaudotnet,项目名称:StockFoo,代码行数:8,代码来源:AllTermDocs.cs

示例12: SetUp

 public override void SetUp()
 {
     base.SetUp();
     Dir = NewDirectory();
     DocHelper.SetupDoc(TestDoc);
     SegmentCommitInfo info = DocHelper.WriteDoc(Random(), Dir, TestDoc);
     Reader = new SegmentReader(info, DirectoryReader.DEFAULT_TERMS_INDEX_DIVISOR, IOContext.READ);
 }
开发者ID:paulirwin,项目名称:lucene.net,代码行数:8,代码来源:TestSegmentReader.cs

示例13: SetUp

		public override void  SetUp()
		{
			base.SetUp();
			DocHelper.SetupDoc(doc1);
			SegmentInfo info1 = DocHelper.WriteDoc(merge1Dir, doc1);
			DocHelper.SetupDoc(doc2);
			SegmentInfo info2 = DocHelper.WriteDoc(merge2Dir, doc2);
			reader1 = SegmentReader.Get(info1);
			reader2 = SegmentReader.Get(info2);
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:10,代码来源:TestSegmentMerger.cs

示例14: SetUp

 public override void  SetUp()
 {
     base.SetUp();
     DocHelper.SetupDoc(doc1);
     SegmentInfo info1 = DocHelper.WriteDoc(merge1Dir, doc1);
     DocHelper.SetupDoc(doc2);
     SegmentInfo info2 = DocHelper.WriteDoc(merge2Dir, doc2);
     reader1 = SegmentReader.Get(true, info1, IndexReader.DEFAULT_TERMS_INDEX_DIVISOR);
     reader2 = SegmentReader.Get(true, info2, IndexReader.DEFAULT_TERMS_INDEX_DIVISOR);
 }
开发者ID:Nangal,项目名称:lucene.net,代码行数:10,代码来源:TestSegmentMerger.cs

示例15: SegmentTermDocs

		public /*protected internal*/ SegmentTermDocs(SegmentReader parent)
		{
			this.parent = parent;
			this.freqStream = (IndexInput) parent.core.freqStream.Clone();
			lock (parent)
			{
				this.deletedDocs = parent.deletedDocs;
			}
			this.skipInterval = parent.core.GetTermsReader().GetSkipInterval();
			this.maxSkipLevels = parent.core.GetTermsReader().GetMaxSkipLevels();
		}
开发者ID:jhuntsman,项目名称:FlexNet,代码行数:11,代码来源:SegmentTermDocs.cs


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