我正在尝试使用 Java 包装器执行 retrieveAndRank 查询。我关注 Retrieve and Rank API 的在线 javadocs。SearchAndRank 的示例是:
https://www.ibm.com/watson/developercloud/retrieve-and-rank/api/v1/#query_ranker
RetrieveAndRank service = new RetrieveAndRank();
service.setUsernameAndPassword("{username}","{password}");
HttpSolrClient solrClient = new HttpSolrClient;
solrClient = getSolrClient(service.getSolrUrl("scfaaf8903_02c1_4297_84c6_76b79537d849"), "{username}","{password}");
SolrQuery query = new SolrQuery("what is the basic mechanism of the transonic aileron buzz");
QueryResponse response = solrClient.query("example_collection", query);
Ranking ranking = service.rank("B2E325-rank-67", response);
System.out.println(ranking);
但是 RetrieveAndRank 类没有这样的 rank(String rankerId, QueryResponse response) 方法。只有一个获取文件或 InputStream 作为参数(浏览 IBM 的源代码,我看到它需要 CSV 内容而不是 java QueryResponse)。
我应该如何将 QueryResponse 传递给 rank 方法?
我正在使用 solr-solrj-5.5.2.jar 和 java-sdk-3.2.0-jar-with-dependencies.jar 库