Commit() public method

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
return void
        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());
        }
Esempio n. 2
0
 protected internal override void DoCommit(System.Collections.Generic.IDictionary <string, string> commitUserData)
 {
     in_Renamed.Commit(commitUserData);
 }
Esempio n. 3
0
 protected internal override void  DoCommit()
 {
     in_Renamed.Commit();
 }
Esempio n. 4
0
 protected internal override void DoCommit(IDictionary <string, string> commitUserData)
 {
     in_Renamed.Commit(commitUserData);
 }