Class IndexUpdateCallbackImpl

java.lang.Object
org.codelibs.fess.ds.callback.IndexUpdateCallbackImpl
All Implemented Interfaces:
IndexUpdateCallback

public class IndexUpdateCallbackImpl extends Object implements IndexUpdateCallback
Implementation of IndexUpdateCallback for handling document indexing operations. This class manages the process of updating the search index with documents from data stores, including bulk operations, document transformation, and error handling.
  • Field Details

    • documentSize

      protected AtomicLong documentSize
      Atomic counter for the number of documents processed
    • executeTime

      protected volatile long executeTime
      Total execution time for all operations
    • docList

      protected final DocList docList
      List of documents waiting to be indexed
    • maxDocumentRequestSize

      protected long maxDocumentRequestSize
      Maximum size of document requests in bytes
    • maxDocumentCacheSize

      protected int maxDocumentCacheSize
      Maximum number of documents to cache before indexing
  • Constructor Details

    • IndexUpdateCallbackImpl

      public IndexUpdateCallbackImpl()
      Default constructor for index update callback implementation. Creates a new instance with default values.
  • Method Details

    • init

      @PostConstruct public void init()
      Initializes the callback implementation after dependency injection. Sets up configuration values and initializes the ingest factory if available.
    • store

      public void store(DataStoreParams paramMap, Map<String,Object> dataMap)
      Stores a document in the index after processing and validation. Handles document transformation, field addition, and batched indexing.
      Specified by:
      store in interface IndexUpdateCallback
      Parameters:
      paramMap - the data store parameters
      dataMap - the document data to store
      Throws:
      DataStoreException - if required fields are missing or other errors occur
    • ingest

      protected Map<String,Object> ingest(DataStoreParams paramMap, Map<String,Object> dataMap)
      Processes a document through the ingest pipeline. Applies all available ingesters to transform the document data.
      Parameters:
      paramMap - the data store parameters
      dataMap - the document data to process
      Returns:
      the processed document data
    • commit

      public void commit()
      Commits any remaining documents in the cache to the index. This method ensures all pending documents are processed.
      Specified by:
      commit in interface IndexUpdateCallback
    • addClickCountField

      protected void addClickCountField(Map<String,Object> doc, String url, String clickCountField)
      Adds click count information to the document.
      Parameters:
      doc - the document to update
      url - the URL to get click count for
      clickCountField - the field name to store click count
    • addFavoriteCountField

      protected void addFavoriteCountField(Map<String,Object> doc, String url, String favoriteCountField)
      Adds favorite count information to the document.
      Parameters:
      doc - the document to update
      url - the URL to get favorite count for
      favoriteCountField - the field name to store favorite count
    • getDocumentSize

      public long getDocumentSize()
      Returns the total number of documents processed.
      Specified by:
      getDocumentSize in interface IndexUpdateCallback
      Returns:
      the number of documents processed
    • getExecuteTime

      public long getExecuteTime()
      Returns the total execution time for all operations.
      Specified by:
      getExecuteTime in interface IndexUpdateCallback
      Returns:
      the total execution time in milliseconds