简体   繁体   English

Java中检索和排名服务的“等级”说明

[英]Explanation on the “Rank” for Retrieve & Rank service in Java

Does anyone ever used the Retrieve & Rank service with Java SDK (Rank service particularly) ? 是否有人使用过Java SDK的“检索和排名”服务(尤其是排名服务)?

I want to understand how it works because some points seem me not logical : 我想了解它的工作原理,因为有些观点似乎不合逻辑:

  • What is the difference between the Java approach, where we must execute a search query with Apache Solr, and then call the method rank ; Java方法有什么区别,在Java方法中,我们必须使用Apache Solr执行搜索查询,然后调用方法rank and the CURL approach, where we just have to run a single query? 和CURL方法,我们只需要运行一个查询?
  • Why the method rank takes a CSV file that contains results from the search query whereas we apparently cannot have the result of a search query in CSV? 为什么方法rank采用包含搜索查询结果的CSV文件,而我们却显然无法获得CSV搜索查询的结果?

I did not find my responses neitheir in this documentation nor in this example . 在本文档或本示例中都没有找到我的答复。

Thanks for your time. 谢谢你的时间。

I have never used Retrieve and Rank before but by reading the documentation here are my thoughts 我以前从未使用过Retrieve和Rank,但是通过阅读文档,我的想法是

  1. I do not think that there any difference between Java approach and CURL. 我认为Java方法和CURL之间没有任何区别。 From what I understand Search and rank in curl uses this command 据我了解,使用curl命令搜索和排名

    curl -u "{username}":"{password}" " https://gateway.watsonplatform.net/retrieve-and-rank/api/v1/solr_clusters/sc1ca23733_faa8_49ce_b3b6_dc3e193264c6/solr/example_collection/fcselect?ranker_id=B2E325-rank-67&q=what%20is%20the%20basic%20mechanism%20of%20the%20transonic%20aileron%20buzz&wt=json&fl=id,title " curl -u“ {用户名}”:“ {密码}”“” https://gateway.watsonplatform.net/retrieve-and-rank/api/v1/solr_clusters/sc1ca23733_faa8_49ce_b3b6_dc3e193264c6/solr/example_collection/fcselect?ranker_id=B2E325- -67&q = what%20is%20the%20basic%20mechanism%20of%20the%20transonic%20aileron%20buzz&wt = json&fl = id,标题为

while in Java 在Java中

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);

I think what the curl command would do, at the back end it would fire a search in Solr using the query specified and after the results returned it would rank them. 我认为curl命令会做什么,在后端它将使用指定的查询在Solr中触发搜索,并在返回结果后对它们进行排名。 In Java this is done explicitly, instead of having a method queryAndRank you have two methods, one that is going to run in Solr, get the results from there and then forward these results to ranking system. 在Java中,这是显式完成的,而不是使用方法queryAndRank,您有两种方法,一种将在Solr中运行,从那里获取结果,然后将这些结果转发给排名系统。

  1. The search in Solr can return csv. Solr中的搜索可以返回csv。

The CSVResponseWriter can write the list of documents in a response in CSV format. CSVResponseWriter可以CSV格式写入响应中的文档列表。

http://wiki.apache.org/solr/CSVResponseWriter http://wiki.apache.org/solr/CSVResponseWriter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM