java.lang.Object
org.hibernate.search.backend.lucene.lowlevel.index.impl.IndexAccessorImpl
All Implemented Interfaces:
AutoCloseable, IndexAccessor

public class IndexAccessorImpl extends Object implements AutoCloseable, IndexAccessor
Author:
Sanne Grinovero (C) 2011 Red Hat Inc.
  • Constructor Details

  • Method Details

    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException
    • createIndexIfMissing

      public void createIndexIfMissing()
      Description copied from interface: IndexAccessor
      Checks whether the index exists (on disk, ...), and creates it if necessary.
      Specified by:
      createIndexIfMissing in interface IndexAccessor
    • validateIndexExists

      public void validateIndexExists()
      Description copied from interface: IndexAccessor
      Checks whether the index exists (on disk, ...), and throws an exception if it doesn't.
      Specified by:
      validateIndexExists in interface IndexAccessor
    • dropIndexIfExisting

      public void dropIndexIfExisting()
      Description copied from interface: IndexAccessor
      Checks whether the index exists (on disk, ...), and drops it if it exists.
      Specified by:
      dropIndexIfExisting in interface IndexAccessor
    • commit

      public void commit()
      Description copied from interface: IndexAccessor
      Commits the underlying index writer, if any.
      Specified by:
      commit in interface IndexAccessor
    • commitOrDelay

      public void commitOrDelay()
      Description copied from interface: IndexAccessor
      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.
      Specified by:
      commitOrDelay in interface IndexAccessor
    • refresh

      public void refresh()
      Description copied from interface: IndexAccessor
      Refreshes the underlying index readers.
      Specified by:
      refresh in interface IndexAccessor
    • mergeSegments

      public void mergeSegments()
      Description copied from interface: IndexAccessor
      Merge segments files.
      Specified by:
      mergeSegments in interface IndexAccessor
    • getIndexWriterDelegator

      public IndexWriterDelegator getIndexWriterDelegator() throws IOException
      Specified by:
      getIndexWriterDelegator in interface IndexAccessor
      Returns:
      The index writer delegator.
      Throws:
      IOException
    • getIndexReader

      public org.apache.lucene.index.DirectoryReader getIndexReader() throws IOException
      Specified by:
      getIndexReader in interface IndexAccessor
      Returns:
      The most up-to-date index reader available.
      Throws:
      IOException
    • cleanUpAfterFailure

      public void cleanUpAfterFailure(Throwable throwable, Object failingOperation)
      Description copied from interface: IndexAccessor
      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, ...).

      Specified by:
      cleanUpAfterFailure in interface IndexAccessor
      Parameters:
      throwable - The failure.
      failingOperation - The operation that failed.
    • computeSizeInBytes

      public long computeSizeInBytes()
      Specified by:
      computeSizeInBytes in interface IndexAccessor
      Returns:
      The size of the index on its storage support, in bytes.
    • getDirectoryForTests

      public org.apache.lucene.store.Directory getDirectoryForTests()
    • getWriterForTests

      public org.apache.lucene.index.IndexWriter getWriterForTests() throws IOException
      Throws:
      IOException
    • getCurrentReaderForTests

      public org.apache.lucene.index.IndexReader getCurrentReaderForTests() throws IOException
      Throws:
      IOException