Interface Committer

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
AbstractBatchCommitter, AbstractCommitter, AbstractFsCommitter, AmazonCloudSearchCommitter, ApacheKafkaCommitter, AzureSearchCommitter, CsvFileCommitter, ElasticsearchCommitter, GoogleCloudSearchCommitter, IdolCommitter, JsonFileCommitter, LogCommitter, MemoryCommitter, Neo4jCommitter, SolrCommitter, SqlCommitter, XmlFileCommitter

public interface Committer extends AutoCloseable
Commits documents to their final destination (e.g. search engine). Implementors are encouraged to use one of the abstract committer classes, which handles event handling and common use cases.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Gets whether this committer accepts to commit the supplied request.
    void
    Cleans any persisted information (e.g. queue) to ensure next run will start fresh.
    void
    Close or release any open resources used by this committer.
    void
    delete(DeleteRequest deleteRequest)
    Deletes the entity represented by the supplied request from the target of this committer.
    void
    init(CommitterContext committerContext)
    Initializes this committer.
    void
    upsert(UpsertRequest upsertRequest)
    Updates or inserts the entity represented by the supplied request into the target of this committer.
  • Method Details

    • init

      void init(CommitterContext committerContext) throws CommitterException
      Initializes this committer. Invoked once per crawl session.
      Parameters:
      committerContext - the committer context
      Throws:
      CommitterException - problem with initialization
    • accept

      boolean accept(CommitterRequest request) throws CommitterException
      Gets whether this committer accepts to commit the supplied request. Useful when routing between multiple committers. Invoked for every CommitterRequest. A request needs to be accepted for upsert(UpsertRequest) or delete(DeleteRequest) to be invoked.
      Parameters:
      request - committer request
      Returns:
      true if accepted
      Throws:
      CommitterException - any error when accepting
    • upsert

      void upsert(UpsertRequest upsertRequest) throws CommitterException
      Updates or inserts the entity represented by the supplied request into the target of this committer.
      Parameters:
      upsertRequest - request to update or insert
      Throws:
      CommitterException - could not process upsert request
    • delete

      void delete(DeleteRequest deleteRequest) throws CommitterException
      Deletes the entity represented by the supplied request from the target of this committer.
      Parameters:
      deleteRequest - request to delete
      Throws:
      CommitterException - could not process delete request
    • close

      void close() throws CommitterException
      Close or release any open resources used by this committer.
      Specified by:
      close in interface AutoCloseable
      Throws:
      CommitterException
    • clean

      void clean() throws CommitterException
      Cleans any persisted information (e.g. queue) to ensure next run will start fresh. Calling this method on Committers not persisting anything between each execution will have no effect. This method does NOT delete anything previously committed on the target repository.
      Throws:
      CommitterException - something went wrong cleaning the committer.