Package org.codelibs.fess.ds.callback
Class IndexUpdateCallbackImpl
java.lang.Object
org.codelibs.fess.ds.callback.IndexUpdateCallbackImpl
- All Implemented Interfaces:
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 Summary
FieldsModifier and TypeFieldDescriptionprotected final DocListList of documents waiting to be indexedprotected AtomicLongAtomic counter for the number of documents processedprotected longTotal execution time for all operationsprotected intMaximum number of documents to cache before indexingprotected longMaximum size of document requests in bytes -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for index update callback implementation. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdds click count information to the document.protected voidAdds favorite count information to the document.voidcommit()Commits any remaining documents in the cache to the index.longReturns the total number of documents processed.longReturns the total execution time for all operations.ingest(DataStoreParams paramMap, Map<String, Object> dataMap) Processes a document through the ingest pipeline.voidinit()Initializes the callback implementation after dependency injection.voidstore(DataStoreParams paramMap, Map<String, Object> dataMap) Stores a document in the index after processing and validation.
-
Field Details
-
documentSize
Atomic counter for the number of documents processed -
executeTime
protected volatile long executeTimeTotal execution time for all operations -
docList
List of documents waiting to be indexed -
maxDocumentRequestSize
protected long maxDocumentRequestSizeMaximum size of document requests in bytes -
maxDocumentCacheSize
protected int maxDocumentCacheSizeMaximum 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
Stores a document in the index after processing and validation. Handles document transformation, field addition, and batched indexing.- Specified by:
storein interfaceIndexUpdateCallback- Parameters:
paramMap- the data store parametersdataMap- the document data to store- Throws:
DataStoreException- if required fields are missing or other errors occur
-
ingest
Processes a document through the ingest pipeline. Applies all available ingesters to transform the document data.- Parameters:
paramMap- the data store parametersdataMap- 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:
commitin interfaceIndexUpdateCallback
-
addClickCountField
Adds click count information to the document.- Parameters:
doc- the document to updateurl- the URL to get click count forclickCountField- the field name to store click count
-
addFavoriteCountField
Adds favorite count information to the document.- Parameters:
doc- the document to updateurl- the URL to get favorite count forfavoriteCountField- the field name to store favorite count
-
getDocumentSize
public long getDocumentSize()Returns the total number of documents processed.- Specified by:
getDocumentSizein interfaceIndexUpdateCallback- Returns:
- the number of documents processed
-
getExecuteTime
public long getExecuteTime()Returns the total execution time for all operations.- Specified by:
getExecuteTimein interfaceIndexUpdateCallback- Returns:
- the total execution time in milliseconds
-