简体   繁体   English

Datastax Solr Java驱动程序CQL

[英]Datastax Solr Java Driver CQL

I am trying use the datastax java connector to talk to dse with solr index. 我正在尝试使用datastax Java连接器与solr索引与dse通讯。

The HTTP Api gives you back numFound, but I can't seem to figure out how to get that information using cql (java connector). HTTP Api为您提供了numFound,但我似乎无法弄清楚如何使用cql(java连接器)获取该信息。

Can anybody tell me how to get this information? 有人可以告诉我如何获取此信息吗? I can make another request 我可以再提出一个要求

select count(*) from table where solr_quer...

But will this be good thing to do, for every page? 但这对每一页来说都是一件好事吗? Is this what http api doing underneath? 这是http api在下面做什么?

I am answering my own question, the datastax ResultSet supports sending and receiving custom payloads, so to retrieve DSESearch.numFound: 我在回答自己的问题,datastax ResultSet支持发送和接收自定义有效负载,因此要检索DSESearch.numFound:

    ResultSet rows = session.execute(...);
    Map<String,ByteBuffer> serverPayload = rows.getExecutionInfo().getIncomingPayload()
    long numFound = serverPayload.get("DSESearch.numFound").getLong();

If you're on DSE 5.0 the response has a custom payload where you'll find numFound . 如果您使用的是DSE 5.0,则响应具有自定义有效负载,您将在其中找到numFound If you're on a previous version you don't have this available unfortunately. 如果您使用的是以前的版本,那么很遗憾没有此功能。

It is mentioned in the manual http://docs.datastax.com/en/latest-dse/datastax_enterprise/srch/queriesCql.html look for DSESearch.numFound 在手册http://docs.datastax.com/en/latest-dse/datastax_enterprise/srch/queriesCql.html手册中提到了DSESearch.numFound

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

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