All Known Implementing Classes:
IndexAccessorImpl

public interface IndexAccessor
The 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

    Modifier and Type
    Method
    Description
    void
    cleanUpAfterFailure(Throwable throwable, Object failingOperation)
    Closes, drops and re-creates any cached resources: index writers, index readers.
    void
    Commits the underlying index writer, if any.
    void
    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.
    long
     
    void
    Checks whether the index exists (on disk, ...), and creates it if necessary.
    void
    Checks whether the index exists (on disk, ...), and drops it if it exists.
    org.apache.lucene.index.DirectoryReader
     
     
    void
    Merge segments files.
    void
    Refreshes the underlying index readers.
    void
    Checks whether the index exists (on disk, ...), and throws an exception if it doesn't.
  • Method Details

    • 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.