code: func (w *IndexWriter) Commit() error {
  	w.ensureOpen()
  	w.commitLock.Lock()
  	defer w.commitLock.Unlock()
  	return w.commitInternal(w.config.MergePolicy())
  }
docs: /*
  Commits all pending changes (added & deleted documents, 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 hav a battery backup (for example) then on power loss
  it may still lose data. Lucene cannot guarantee consistency on such
  devices.
  */