@@ -28,6 +28,7 @@ APIs and SDKs that use cognitive computing to solve complex problems.
2828 * [ Natural Language Classifier] ( #natural-language-classifier )
2929 * [ Personality Insights] ( #personality-insights )
3030 * [ Relationship Extraction] ( #relationship-extraction )
31+ * [ Retrieve and Rank] ( #retrieve-and-rank )
3132 * [ Speech to Text] ( #speech-to-text )
3233 * [ Text to Speech] ( #text-to-speech )
3334 * [ Tone Analyzer] ( #tone-analyzer )
@@ -52,13 +53,13 @@ Now, you are ready to see some [examples](https://github.com/watson-developer-cl
5253<dependency >
5354 <groupId >com.ibm.watson.developer_cloud</groupId >
5455 <artifactId >java-sdk</artifactId >
55- <version >2.0 .0</version >
56+ <version >2.1 .0</version >
5657</dependency >
5758```
5859##### Gradle
5960
6061``` gradle
61- 'com.ibm.watson.developer_cloud:java-sdk:2.0 .0'
62+ 'com.ibm.watson.developer_cloud:java-sdk:2.1 .0'
6263```
6364
6465## Usage
@@ -131,14 +132,26 @@ System.out.println(keywords);
131132```
132133
133134### Alchemy Data News
134- [ Alchemy Data News] [ alchemy_data_news ] indexes 250k to 300k English language news and blog articles every day with historical search available for the past 60 days.
135- Example: Get the volume data from the last 7 days using 12hs of time slice.
136-
135+ [ Alchemy Data News] [ alchemy_data_news ] indexes 250k to 300k English language news and
136+ blog articles every day with historical search available for the past 60 days.
137+ Example: Get 7 documents between Friday 28th August 2015 and Friday 4th September 2015.
138+
137139``` java
138140AlchemyDataNews service = new AlchemyDataNews ();
139141service. setApiKey(" <api_key>" );
140142
141- VolumeResult result = service. getVolume(" now-7d" , " now" , " 12h" );
143+ Map<String , Object > params = new HashMap<String , Object > ();
144+
145+ String [] fields =
146+ new String [] {" enriched.url.title" , " enriched.url.url" , " enriched.url.author" ,
147+ " enriched.url.publicationDate" , " enriched.url.enrichedTitle.entities" ,
148+ " enriched.url.enrichedTitle.docSentiment" };
149+ params. put(AlchemyDataNews . RETURN , StringUtils . join(fields, " ," ));
150+ params. put(AlchemyDataNews . START , " 1440720000" );
151+ params. put(AlchemyDataNews . END , " 1441407600" );
152+ params. put(AlchemyDataNews . COUNT , 7 );
153+
154+ DocumentsResult result = service. getNewsDocuments(params);
142155
143156System . out. println(result);
144157```
@@ -178,7 +191,7 @@ DocumentConversion service = new DocumentConversion();
178191service. setUsernameAndPassword(" <username>" , " <password>" );
179192
180193File doc = new File (" src/test/resources/document_conversion/word-document-heading-input.doc" );
181- Answers htmlToAnswers = service. convertDocumentToAnswer(doc, null );
194+ Answers htmlToAnswers = service. convertDocumentToAnswer(doc);
182195System . out. println(htmlToAnswers);
183196```
184197
@@ -257,6 +270,36 @@ String response = service.extract("IBM Watson Developer Cloud");
257270System . out. println(response);
258271```
259272
273+
274+ ### Retrieve and Rank
275+ The [ Retrieve and Rank] [ retrieve_and_rank ] service helps users find the most
276+ relevant information for their query by using a combination of search and
277+ machine learning to find “signals” in the data.
278+
279+
280+ ``` java
281+ RetrieveAndRank service = new RetrieveAndRank ();
282+ service. setUsernameAndPassword(" <username>" , " <password>" );
283+
284+ // 1 create the Solr Cluster
285+ SolrClusterOptions options = new SolrClusterOptions (" my-cluster-name" , 1 );
286+ SolrCluster cluster = service. createSolrCluster(options);
287+ System . out. println(" Solr cluster: " + cluster);
288+
289+ // 2 wait until the Solr Cluster is available
290+ while (cluster. getStatus() == Status . NOT_AVAILABLE ) {
291+ Thread . sleep(10000 ); // sleep 10 seconds
292+ cluster = service. getSolrCluster(cluster. getId());
293+ System . out. println(" Solr cluster status: " + cluster. getStatus());
294+ }
295+
296+ // 3 list Solr Clusters
297+ System . out. println(" Solr clusters: " + service. getSolrClusters());
298+ ```
299+
300+ Retrieve and Rank is built on top of Apache Solr.
301+ Look at [ this] ( https://github.com/watson-developer-cloud/java-sdk/tree/master/examples/retrieve-and-rank-solrj ) example to learn how to use Solrj.
302+
260303### Speech to Text
261304Use the [ Speech to Text] [ speech_to_text ] service to recognize the text from a .wav file.
262305
@@ -411,7 +454,7 @@ Gradle:
411454
412455 ``` sh
413456 $ cd java-sdk
414- $ gradle jar # build jar file (build/libs/watson-developer-cloud-2.0 .0.jar)
457+ $ gradle jar # build jar file (build/libs/watson-developer-cloud-2.1 .0.jar)
415458 $ gradle test # run tests
416459 ```
417460
@@ -465,6 +508,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md).
465508[ dialog ] : http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/dialog/
466509[ concept-insights ] : https://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/concept-insights/
467510[ visual_insights ] : http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/visual-insights/
511+ [ retrieve_and_rank ] : http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/retrieve-rank/
468512
469513[ alchemy_language ] : http://www.alchemyapi.com/products/alchemylanguage
470514[ sentiment_analysis ] : http://www.alchemyapi.com/products/alchemylanguage/sentiment-analysis
0 commit comments