Expert: prepare for commit, specifying commitUserData Map (String -> String). This does the first phase of 2-phase commit. You can only call this when autoCommit is false. This method does all steps necessary to commit changes since this writer was opened: flushes pending added and deleted docs, syncs the index files, writes most of next segments_N file. After calling this you must call either {@link #Commit()} to finish the commit, or {@link #Rollback()} to revert the commit and undo all changes done since the writer was opened.

You can also just call {@link #Commit(Map)} directly without prepareCommit first in which case that method will internally call prepareCommit.

NOTE: if this method hits an OutOfMemoryError you should immediately close the writer. See above for details.

Namespace: Lucene.Net.Index
Assembly: Lucene.Net (in Lucene.Net.dll) Version: 2.9.4.1

Syntax

C#
public void PrepareCommit(
	IDictionary<string, string> commitUserData
)
Visual Basic
Public Sub PrepareCommit ( _
	commitUserData As IDictionary(Of String, String) _
)
Visual C++
public:
void PrepareCommit(
	IDictionary<String^, String^>^ commitUserData
)

Parameters

commitUserData
Type: System.Collections.Generic..::..IDictionary<(Of <(<'String, String>)>)>
Opaque Map (String->String) that's recorded into the segments file in the index, and retrievable by {@link IndexReader#getCommitUserData}. Note that when IndexWriter commits itself, for example if open with autoCommit=true, or, during {@link #close}, the commitUserData is unchanged (just carried over from the prior commit). If this is null then the previous commitUserData is kept. Also, the commitUserData will only "stick" if there are actually changes in the index to commit. Therefore it's best to use this feature only when autoCommit is false.

See Also