Available as of Camel 2.9
The Solr component allows you to interface with an Apache Lucene Solr server (based on SolrJ 3.5.0).
Maven users will need to add the following dependency to their
pom.xml for this component:
NOTE: solrs and solrCloud are new added since Camel 2.14.
The following SolrServer options may be configured on the Solr endpoint.
maximum number of retries to attempt in the event of transient errors
read timeout on the underlying HttpConnectionManager. This is desirable for queries, but probably not for indexing
connectionTimeout on the underlying HttpConnectionManager
maxConnectionsPerHost on the underlying HttpConnectionManager
maxTotalConnection on the underlying HttpConnectionManager
indicates whether redirects are used to get to the Solr server
server side must support gzip or deflate for this to have any effect
set the request handler to be used
Camel 2.9.2 set the number of threads for the StreamingUpdateSolrServer
Camel 2.9.2 set the queue size for the StreamingUpdateSolrServer
|zkhost||null||Camel 2.14.0 set the zoo keeper host information which the solrCloud could use, such as "zkhost=localhost:8123".|
|collection||null||Camel 2.14.0 set the collection name which the solrCloud server could use|
The following Solr operations are currently supported. Simply set an exchange header with a key of "SolrOperation" and a value set to one of the following. Some operations also require the message body to be set.
- the INSERT operations use the CommonsHttpSolrServer
- the INSERT_STREAMING operations use the StreamingUpdateSolrServer (Camel 2.9.2)
adds an index using message headers (must be prefixed with "SolrField.")
adds an index using the given File (using ContentStreamUpdateRequest)
Camel 2.9.2 updates index based on the given SolrInputDocument
Camel 2.9.2 updates index based on the given XML (must follow SolrInputDocument format)
adds an index based on values in an annotated bean
|ADD_BEANS||collection<bean>||Camel 2.15 adds index based on a collection of annotated bean|
index id to delete
delete a record by ID
delete a record by a query
performs a commit on any pending index changes
performs a rollback on any pending index changes
performs a commit on any pending index changes and then runs the optimize command
Below is a simple INSERT, DELETE and COMMIT example
A client would simply need to pass a body message to the insert or delete routes and then call the commit route.
Currently, this component doesn't support querying data natively (may be added later). For now, you can query Solr using HTTP as follows:
For more information, see these resources...