Package com.norconex.committer.solr
Class SolrCommitter
java.lang.Object
com.norconex.committer.core.AbstractCommitter<SolrCommitterConfig>
com.norconex.committer.core.batch.AbstractBatchCommitter<SolrCommitterConfig>
com.norconex.committer.solr.SolrCommitter
- All Implemented Interfaces:
BatchConsumer,Committer,Configurable<SolrCommitterConfig>,AutoCloseable
Commits documents to Apache Solr.
Solr Client:
You can specify which type of
Solr Client to use.
The expected configuration value of "solrURL" is influenced
by the client type chosen. Default client type is
Http2SolrClient. The clients are:
- Http2SolrClient
- Default client. For direct access to a single Solr node. Ideal for local development or small setups. Expects a Solr URL.
- CloudSolrClient
- For use with a SolrCloud cluster. Expects a comma-separated list of Zookeeper hosts.
- LBHttp2SolrClient
- Simple load-balancing as an alternative to an external load balancer. Expects two or more Solr node URLs (comma-separated).
- ConcurrentUpdateHttp2SolrClient
- Optimized for mass upload on a single node. Not best for queries. Expects a Solr URL.
The above client types are using the HTTP/2 protocol. They should be favored over the following, which are using HTTP/1.x and are considered deprecated:
- HttpSolrClient
- For direct access to a single Solr node. Ideal for local development. Expects a Solr URL.
- LBHttpSolrClient
- Simple load-balancing as an alternative to an external load balancer. Expects two or more Solr node URLs (comma-separated).
- ConcurrentUpdateSolrClient
- Optimized for mass upload on a single node. Not best for queries. Expects a Solr URL.
Authentication
Basic authentication is supported for password-protected Solr installations.
-
Field Summary
Fields inherited from interface com.norconex.commons.lang.config.Configurable
PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddSolrDeleteRequest(org.apache.solr.client.solrj.request.UpdateRequest solrBatchRequest, DeleteRequest committerRequest) protected voidaddSolrUpsertRequest(org.apache.solr.client.solrj.request.UpdateRequest solrBatchRequest, UpsertRequest committerRequest) protected org.apache.solr.common.SolrInputDocumentbuildSolrDocument(Properties fields) protected booleanprotected voidSubclasses can perform additional closing logic by overriding this method.protected voidCommits the supplied batch.booleaninthashCode()protected voidSubclasses can perform additional initialization by overriding this method.protected voidpushSolrRequest(org.apache.solr.client.solrj.request.UpdateRequest solrBatchRequest) toString()Methods inherited from class com.norconex.committer.core.batch.AbstractBatchCommitter
consume, doClean, doClose, doDelete, doInit, doUpsert, getInitializedQueueMethods inherited from class com.norconex.committer.core.AbstractCommitter
accept, applyFieldMappings, clean, close, delete, fireDebug, fireDebug, fireError, fireError, fireInfo, fireInfo, getCommitterContext, init, upsert
-
Constructor Details
-
SolrCommitter
public SolrCommitter()
-
-
Method Details
-
initBatchCommitter
Description copied from class:AbstractBatchCommitterSubclasses can perform additional initialization by overriding this method. Default implementation does nothing. The committer context and committer queue will be already initialized when invokingAbstractCommitter.getCommitterContext()andAbstractBatchCommitter.getInitializedQueue(), respectively.- Overrides:
initBatchCommitterin classAbstractBatchCommitter<SolrCommitterConfig>- Throws:
CommitterException- error initializing
-
commitBatch
Description copied from class:AbstractBatchCommitterCommits the supplied batch.- Specified by:
commitBatchin classAbstractBatchCommitter<SolrCommitterConfig>- Parameters:
it- the batch to commit- Throws:
CommitterException- could not commit the batch
-
closeBatchCommitter
Description copied from class:AbstractBatchCommitterSubclasses can perform additional closing logic by overriding this method. Default implementation does nothing.- Overrides:
closeBatchCommitterin classAbstractBatchCommitter<SolrCommitterConfig>- Throws:
CommitterException- error closing committer
-
pushSolrRequest
protected void pushSolrRequest(org.apache.solr.client.solrj.request.UpdateRequest solrBatchRequest) throws org.apache.solr.client.solrj.SolrServerException, IOException, CommitterException - Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOExceptionCommitterException
-
addSolrUpsertRequest
protected void addSolrUpsertRequest(org.apache.solr.client.solrj.request.UpdateRequest solrBatchRequest, UpsertRequest committerRequest) throws CommitterException - Throws:
CommitterException
-
addSolrDeleteRequest
protected void addSolrDeleteRequest(org.apache.solr.client.solrj.request.UpdateRequest solrBatchRequest, DeleteRequest committerRequest) -
buildSolrDocument
-
equals
- Overrides:
equalsin classAbstractBatchCommitter<SolrCommitterConfig>
-
canEqual
- Overrides:
canEqualin classAbstractBatchCommitter<SolrCommitterConfig>
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractBatchCommitter<SolrCommitterConfig>
-
toString
- Overrides:
toStringin classAbstractBatchCommitter<SolrCommitterConfig>
-
getConfiguration
-