Skip to content

Latest commit

 

History

History
48 lines (37 loc) · 1.47 KB

README.md

File metadata and controls

48 lines (37 loc) · 1.47 KB

Retrieve and Rank

Installation

Maven
<dependency>
	<groupId>com.ibm.watson.developer_cloud</groupId>
	<artifactId>retrieve-and-rank</artifactId>
	<version>3.5.3</version>
</dependency>
Gradle
'com.ibm.watson.developer_cloud:retrieve-and-rank:3.5.3'

Usage

The Retrieve and Rank service helps users find the most relevant information for their query by using a combination of search and machine learning to find "signals" in the data.

RetrieveAndRank service = new RetrieveAndRank();
service.setUsernameAndPassword("<username>", "<password>");

// 1 create the Solr Cluster
SolrClusterOptions options = new SolrClusterOptions("my-cluster-name", 1);
SolrCluster cluster = service.createSolrCluster(options).execute();
System.out.println("Solr cluster: " + cluster);

// 2 wait until the Solr Cluster is available
while (cluster.getStatus() == Status.NOT_AVAILABLE) {
  Thread.sleep(10000); // sleep 10 seconds
  cluster = service.getSolrCluster(cluster.getId()).execute();
  System.out.println("Solr cluster status: " + cluster.getStatus());
}

// 3 list Solr Clusters
System.out.println("Solr clusters: " + service.getSolrClusters().execute());

Retrieve and Rank is built on top of Apache Solr. Look at this example to learn how to use Solrj.