Reply
Explorer
Posts: 28
Registered: ‎03-17-2017

Use Solj with Cloudera Search

Is it possible to use Solrj with Cloudera Search.  Are there any sample Java code that shows how to setup Solrj to connect to Cloudera Search running on CDH 5.10 cluster, and then perform query against indexed resources.

 

Any example or a pointer to one is appreciated.

Highlighted
Cloudera Employee
Posts: 172
Registered: ‎01-09-2014

Re: Use Solj with Cloudera Search

The important piece of connecting to Cloudera search is to use the CloudSolrServer method as noted here: https://wiki.apache.org/solr/Solrj#Using_with_SolrCloud

 

 

The important piece of connecting to Cloudera search is to use the CloudSolrServer method as noted here:
https://wiki.apache.org/solr/Solrj#Using_with_SolrCloud

 

 

import org.apache.solr.client.solrj.impl.CloudSolrServer;
import org.apache.solr.common.SolrInputDocument;
CloudSolrServer server = new CloudSolrServer("localhost:9983");
server.setDefaultCollection("collection1");
SolrInputDocument doc = new SolrInputDocument();
doc.addField( "id", "1234");
doc.addField( "name", "A lovely summer holiday");
server.add(doc);
server.commit();

 

 

 

-pd

Announcements