Interface IndexAccessor
-
- All Known Implementing Classes:
IndexAccessorImpl
public interface IndexAccessorThe entry point for low-level I/O operations on a Lucene index.Used to retrieve the index writer and index reader in particular.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcleanUpAfterFailure(Throwable throwable, Object failingOperation)Closes, drops and re-creates any cached resources: index writers, index readers.voidcommit()Commits the underlying index writer, if any.voidcommitOrDelay()Commits the underlying index writer, if any, or delay the commit if a commit happened recently and configuration requires to wait longer between two commits.longcomputeSizeInBytes()voidcreateIndexIfMissing()Checks whether the index exists (on disk, ...), and creates it if necessary.voiddropIndexIfExisting()Checks whether the index exists (on disk, ...), and drops it if it exists.org.apache.lucene.index.DirectoryReadergetIndexReader()IndexWriterDelegatorgetIndexWriterDelegator()voidmergeSegments()Merge segments files.voidrefresh()Refreshes the underlying index readers.voidvalidateIndexExists()Checks whether the index exists (on disk, ...), and throws an exception if it doesn't.
-
-
-
Method Detail
-
createIndexIfMissing
void createIndexIfMissing()
Checks whether the index exists (on disk, ...), and creates it if necessary.
-
validateIndexExists
void validateIndexExists()
Checks whether the index exists (on disk, ...), and throws an exception if it doesn't.
-
dropIndexIfExisting
void dropIndexIfExisting()
Checks whether the index exists (on disk, ...), and drops it if it exists.
-
commit
void commit()
Commits the underlying index writer, if any.
-
commitOrDelay
void commitOrDelay()
Commits the underlying index writer, if any, or delay the commit if a commit happened recently and configuration requires to wait longer between two commits.
-
refresh
void refresh()
Refreshes the underlying index readers.
-
mergeSegments
void mergeSegments()
Merge segments files.
-
getIndexWriterDelegator
IndexWriterDelegator getIndexWriterDelegator() throws IOException
- Returns:
- The index writer delegator.
- Throws:
IOException
-
getIndexReader
org.apache.lucene.index.DirectoryReader getIndexReader() throws IOException- Returns:
- The most up-to-date index reader available.
- Throws:
IOException
-
cleanUpAfterFailure
void cleanUpAfterFailure(Throwable throwable, Object failingOperation)
Closes, drops and re-creates any cached resources: index writers, index readers.Should be used to clean up the accessor upon write or commit failure, passing an exception with as much information as possible (operation, document ID, ...).
- Parameters:
throwable- The failure.failingOperation- The operation that failed.
-
computeSizeInBytes
long computeSizeInBytes()
- Returns:
- The size of the index on its storage support, in bytes.
-
-