Class SolrCommitter
- All Implemented Interfaces:
BatchConsumer,Committer,Configurable<SolrCommitterConfig>,AutoCloseable
Commits documents to Apache Solr (and Solr-based products, such as LucidWorks Fusion). It sends JSON update requests over HTTP and does not depend on the SolrJ library.
Connection mode
The Solr URLs to send documents to are specified as nodes.
Each is a Solr "core" or "collection" URL, such as
http://localhost:8983/solr/mycollection.
The connectionMode defines how they are used:
- SINGLE_NODE
- Direct access to a single Solr node. Default with one node.
- LOAD_BALANCED
- Simple load-balancing as an alternative to an external load balancer. Default with several nodes. Updates are spread across nodes. A failing node is set aside for a while and the request is sent to another one.
- CLOUD
- For use with a SolrCloud cluster. Each node URL ends with the
collection name. The nodes currently hosting the collection are
discovered over HTTP (Collections API
CLUSTERSTATUS) and refreshed periodically, so ZooKeeper does not have to be reachable. Updates are spread across these nodes. If the cluster state cannot be obtained (e.g., missing permission) or discovered nodes are unreachable, the configured nodes are used. ZooKeeper connection strings are not supported.
The httpVersion is AUTO by default: HTTP/2 is
used with "https" URLs, HTTP/1.1 otherwise.
Deprecated: solrClientType (SolrJ client names) and
solrURL (comma-separated URLs) are replaced by
connectionMode, httpVersion and
nodes. They are still honored for now.
Authentication
The following are supported, and sent with every request to Solr:
- Basic authentication: with
credentials(password can be encrypted). - Bearer token: with
bearerToken(e.g., for the Solr JWT authentication plugin). Ignored when basic credentials are set. - Custom HTTP headers: with
headers(e.g., for an API gateway or a reverse proxy). These can override theAuthorizationheader set by the above. - TLS: for HTTPS, the JVM default trust store is used
(customizable with the standard
javax.net.ssl.*system properties, including for client certificates).
HTTP proxies are those of the JVM (standard http.proxyHost
and https.proxyHost system properties).
Kerberos authentication is not supported.
-
Field Summary
Fields inherited from interface com.norconex.commons.lang.config.Configurable
PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected 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.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, aclFormat, applyFieldMappings, clean, close, defaultAclFormat, delete, fireDebug, fireDebug, fireError, fireError, fireInfo, fireInfo, getCommitterContext, init, nativeAclProblem, supportsNativeAcl, 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
-
equals
- Overrides:
equalsin classAbstractBatchCommitter<SolrCommitterConfig>
-
canEqual
- Overrides:
canEqualin classAbstractBatchCommitter<SolrCommitterConfig>
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractBatchCommitter<SolrCommitterConfig>
-
toString
- Overrides:
toStringin classAbstractBatchCommitter<SolrCommitterConfig>
-
getConfiguration
-