close
Closes all open resources and releases the write lock.
If IndexWriterConfig.commitOnClose is true, this will attempt to gracefully shut down by writing any changes, waiting for any running merges, committing, and closing. In this case, note that:
If you called prepareCommit but failed to call commit, this method will throw
IllegalStateExceptionand theIndexWriterwill not be closed.If this method throws any other exception, the
IndexWriterwill be closed, but changes may have been lost.
Note that this may be a costly operation, so, try to re-use a single writer instead of closing and opening a new one. See .commit for caveats about write caching done by some IO devices.
NOTE: You must ensure no other threads are still making changes at the same time that this method is invoked.