File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
main/java/com/ibm/watson/developer_cloud/retrieve_and_rank/v1
test/java/com/ibm/watson/developer_cloud/retrieve_and_rank/v1 Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ public class RetrieveAndRank extends WatsonService implements ClusterLifecycleMa
7777 private static final String PATH_CREATE_RANKER = "/v1/rankers" ;
7878
7979 private static final String PATH_GET_SOLR_CLUSTER = "/v1/solr_clusters/%s" ;
80+ private static final String PATH_SOLR = "/v1/solr_clusters/%s/solr" ;
8081 private static final String PATH_RANK = "/v1/rankers/%s/rank" ;
8182 private static final String PATH_RANKER = "/v1/rankers/%s" ;
8283 private static final String PATH_RANKERS = "/v1/rankers" ;
@@ -313,9 +314,19 @@ public SolrClusterList getSolrClusters() {
313314 return executeRequest (request , SolrClusterList .class );
314315 }
315316
317+ /**
318+ * This URL can be used with the SolrJ library to access Solr functionality.
319+ *
320+ * @param solrClusterId the ID of the Solr cluster to connect to
321+ * @return URL to access Solr
322+ */
323+ public String getSolrUrl (String solrClusterId ) {
324+ return String .format (PATH_SOLR , solrClusterId );
325+ }
326+
316327 /**
317328 * Gets and returns the ranked answers.
318- *
329+ *
319330 * @param rankerID The ranker ID
320331 * @param answers The CSV file that contains the search results that you want to rank.
321332 * @param topAnswers The number of top answers needed, default is 10
Original file line number Diff line number Diff line change @@ -185,6 +185,13 @@ public void testGetSolrClusters() {
185185 assertTrue (!clusters .getSolrClusters ().isEmpty ());
186186 }
187187
188+ @ Test
189+ public void testGetSolrUrl () {
190+ final String solrUrl = service .getSolrUrl (clusterId );
191+ final String expectedUrl = "/solr_clusters/" + clusterId + "/solr" ;
192+ assertTrue (solrUrl .endsWith (expectedUrl ));
193+ }
194+
188195 @ Test
189196 public void testUploadAndDeleteSolrClusterConfigurationDirectory () {
190197 try {
You can’t perform that action at this time.
0 commit comments