Lucene.Net.Index.IndexReader.DecRef C# (CSharp) Method

DecRef() public method

Expert: decreases the refCount of this IndexReader instance. If the refCount drops to 0, then pending changes (if any) are committed to the index and this reader is closed.
public DecRef ( ) : void
return void
		public virtual void  DecRef()
		{
			lock (this)
			{
				System.Diagnostics.Debug.Assert(refCount > 0);
				EnsureOpen();
				if (refCount == 1)
				{
					Commit();
					DoClose();
				}
				refCount--;
			}
		}
		

Usage Example

Example #1
0
        public virtual void  TestLucene1516Bug()
        {
            Directory dir1 = new MockRAMDirectory();

            TestIndexReaderReopen.CreateIndex(dir1, false);
            IndexReader r1 = IndexReader.Open(dir1, false);

            r1.IncRef();
            IndexReader r2 = r1.Clone(false);

            r1.DeleteDocument(5);
            r1.DecRef();

            r1.IncRef();

            r2.Close();
            r1.DecRef();
            r1.Close();
            dir1.Close();
        }
All Usage Examples Of Lucene.Net.Index.IndexReader::DecRef