Package com.norconex.committer.core
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
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 TypeMethodDescriptionbooleanaccept(CommitterRequest request) Gets whether this committer accepts to commit the supplied request.voidclean()Cleans any persisted information (e.g. queue) to ensure next run will start fresh.voidclose()Close or release any open resources used by this committer.voiddelete(DeleteRequest deleteRequest) Deletes the entity represented by the supplied request from the target of this committer.voidinit(CommitterContext committerContext) Initializes this committer.voidupsert(UpsertRequest upsertRequest) Updates or inserts the entity represented by the supplied request into the target of this committer.
-
Method Details
-
init
Initializes this committer. Invoked once per crawl session.- Parameters:
committerContext- the committer context- Throws:
CommitterException- problem with initialization
-
accept
Gets whether this committer accepts to commit the supplied request. Useful when routing between multiple committers. Invoked for everyCommitterRequest. A request needs to be accepted forupsert(UpsertRequest)ordelete(DeleteRequest)to be invoked.- Parameters:
request- committer request- Returns:
trueif accepted- Throws:
CommitterException- any error when accepting
-
upsert
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
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
Close or release any open resources used by this committer.- Specified by:
closein interfaceAutoCloseable- Throws:
CommitterException
-
clean
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.
-