prepareCommit
Expert: prepare for commit. This does the first phase of 2-phase commit. 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 .commit to finish the commit, or .rollback to revert the commit and undo all changes done since the writer was opened.
You can also just call .commit directly without prepareCommit first in which case that method will internally call prepareCommit.
Return
The #sequence_number of the last operation in the commit. All sequence numbers <= this value will be reflected in the commit, and all others will not.