Class IndexAccessorImpl
java.lang.Object
org.hibernate.search.backend.lucene.lowlevel.index.impl.IndexAccessorImpl
- All Implemented Interfaces:
AutoCloseable,IndexAccessor
- Author:
- Sanne Grinovero (C) 2011 Red Hat Inc.
-
Constructor Summary
ConstructorsConstructorDescriptionIndexAccessorImpl(EventContext eventContext, DirectoryHolder directoryHolder, IndexWriterProvider indexWriterProvider, IndexReaderProvider indexReaderProvider) -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanUpAfterFailure(Throwable throwable, Object failingOperation) Closes, drops and re-creates any cached resources: index writers, index readers.voidclose()voidcommit()Commits the underlying index writer, if any.voidCommits the underlying index writer, if any, or delay the commit if a commit happened recently and configuration requires to wait longer between two commits.longvoidChecks whether the index exists (on disk, ...), and creates it if necessary.voidChecks whether the index exists (on disk, ...), and drops it if it exists.org.apache.lucene.index.IndexReaderorg.apache.lucene.store.Directoryorg.apache.lucene.index.DirectoryReaderorg.apache.lucene.index.IndexWritervoidMerge segments files.voidrefresh()Refreshes the underlying index readers.voidChecks whether the index exists (on disk, ...), and throws an exception if it doesn't.
-
Constructor Details
-
IndexAccessorImpl
public IndexAccessorImpl(EventContext eventContext, DirectoryHolder directoryHolder, IndexWriterProvider indexWriterProvider, IndexReaderProvider indexReaderProvider)
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-
createIndexIfMissing
public void createIndexIfMissing()Description copied from interface:IndexAccessorChecks whether the index exists (on disk, ...), and creates it if necessary.- Specified by:
createIndexIfMissingin interfaceIndexAccessor
-
validateIndexExists
public void validateIndexExists()Description copied from interface:IndexAccessorChecks whether the index exists (on disk, ...), and throws an exception if it doesn't.- Specified by:
validateIndexExistsin interfaceIndexAccessor
-
dropIndexIfExisting
public void dropIndexIfExisting()Description copied from interface:IndexAccessorChecks whether the index exists (on disk, ...), and drops it if it exists.- Specified by:
dropIndexIfExistingin interfaceIndexAccessor
-
commit
public void commit()Description copied from interface:IndexAccessorCommits the underlying index writer, if any.- Specified by:
commitin interfaceIndexAccessor
-
commitOrDelay
public void commitOrDelay()Description copied from interface:IndexAccessorCommits the underlying index writer, if any, or delay the commit if a commit happened recently and configuration requires to wait longer between two commits.- Specified by:
commitOrDelayin interfaceIndexAccessor
-
refresh
public void refresh()Description copied from interface:IndexAccessorRefreshes the underlying index readers.- Specified by:
refreshin interfaceIndexAccessor
-
mergeSegments
public void mergeSegments()Description copied from interface:IndexAccessorMerge segments files.- Specified by:
mergeSegmentsin interfaceIndexAccessor
-
getIndexWriterDelegator
- Specified by:
getIndexWriterDelegatorin interfaceIndexAccessor- Returns:
- The index writer delegator.
- Throws:
IOException
-
getIndexReader
- Specified by:
getIndexReaderin interfaceIndexAccessor- Returns:
- The most up-to-date index reader available.
- Throws:
IOException
-
cleanUpAfterFailure
Description copied from interface:IndexAccessorCloses, 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, ...).
- Specified by:
cleanUpAfterFailurein interfaceIndexAccessor- Parameters:
throwable- The failure.failingOperation- The operation that failed.
-
computeSizeInBytes
public long computeSizeInBytes()- Specified by:
computeSizeInBytesin interfaceIndexAccessor- Returns:
- The size of the index on its storage support, in bytes.
-
getDirectoryForTests
public org.apache.lucene.store.Directory getDirectoryForTests() -
getWriterForTests
- Throws:
IOException
-
getCurrentReaderForTests
- Throws:
IOException
-