Lucene.Net.Index.IndexReader.Commit C# (CSharp) 메소드

Commit() 공개 메소드

Commit changes resulting from delete, undeleteAll, or setNorm operations If an exception is hit, then either no changes or all changes will have been committed to the index (transactional semantics).
public Commit ( ) : void
리턴 void
		public /*protected internal*/ void  Commit()
		{
			lock (this)
			{
				Commit(null);
			}
		}
		

Same methods

IndexReader::Commit ( string>.IDictionary commitUserData ) : void

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::Commit