Commits all pending changes (added & deleted
documents, optimizations, segment merges, added
indexes, etc.) to the index, and syncs all referenced
index files, such that a reader will see the changes
and the index updates will survive an OS or machine
crash or power loss. Note that this does not wait for
any running background merges to finish. This may be a
costly operation, so you should test the cost in your
application and do it only when really necessary.
Note that this operation calls Directory.sync on
the index files. That call should not return until the
file contents & metadata are on stable storage. For
FSDirectory, this calls the OS's fsync. But, beware:
some hardware devices may in fact cache writes even
during fsync, and return before the bits are actually
on stable storage, to give the appearance of faster
performance. If you have such a device, and it does
not have a battery backup (for example) then on power
loss it may still lose data. Lucene cannot guarantee
consistency on such devices.
NOTE: if this method hits an OutOfMemoryError
you should immediately close the writer. See
above for details.
Namespace: Lucene.Net.IndexAssembly: Lucene.Net (in Lucene.Net.dll) Version: 2.9.4.1
Syntax
Visual Basic |
---|
Public Sub Commit |
Visual C++ |
---|
public:
void Commit() |
See Also
[!:prepareCommit]
[!:Commit(Map)]