1
votes

I am trying use the datastax java connector to talk to dse with solr index.

The HTTP Api gives you back numFound, but I can't seem to figure out how to get that information using cql (java connector).

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?

2

2 Answers

1
votes

I am answering my own question, the datastax ResultSet supports sending and receiving custom payloads, so to retrieve DSESearch.numFound:

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

If you're on DSE 5.0 the response has a custom payload where you'll find 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