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

UndeleteAll() public method

Undeletes all documents currently marked as deleted in this index. since this reader was opened has this index open (write.lock could not be obtained)
public UndeleteAll ( ) : void
return void
		public virtual void  UndeleteAll()
		{
			lock (this)
			{
				EnsureOpen();
				AcquireWriteLock();
				hasChanges = true;
				DoUndeleteAll();
			}
		}
		

Usage Example

        public virtual void  DoTestUndeleteAll()
        {
            sis.Read(dir);
            IndexReader reader = OpenReader();

            Assert.IsTrue(reader != null);
            Assert.AreEqual(2, reader.NumDocs());
            reader.DeleteDocument(0);
            Assert.AreEqual(1, reader.NumDocs());
            reader.UndeleteAll();
            Assert.AreEqual(2, reader.NumDocs());

            // Ensure undeleteAll survives commit/close/reopen:
            reader.Commit();
            reader.Close();

            if (reader is MultiReader)
            {
                // MultiReader does not "own" the directory so it does
                // not write the changes to sis on commit:
                sis.Commit(dir);
            }

            sis.Read(dir);
            reader = OpenReader();
            Assert.AreEqual(2, reader.NumDocs());

            reader.DeleteDocument(0);
            Assert.AreEqual(1, reader.NumDocs());
            reader.Commit();
            reader.Close();
            if (reader is MultiReader)
            {
                // MultiReader does not "own" the directory so it does
                // not write the changes to sis on commit:
                sis.Commit(dir);
            }
            sis.Read(dir);
            reader = OpenReader();
            Assert.AreEqual(1, reader.NumDocs());
        }
All Usage Examples Of Lucene.Net.Index.IndexReader::UndeleteAll