.withRangeStart(BinaryValue.unsafeCreate(String.valueOf(5L).getBytes()))
.withRangeEnd(BinaryValue.unsafeCreate(String.valueOf(20L).getBytes()))
.withPaginationSort(true)
.build();
SecondaryIndexQueryOperation queryOp =
new SecondaryIndexQueryOperation.Builder(query)
.build();
cluster.execute(queryOp);
SecondaryIndexQueryOperation.Response response = queryOp.get();
assertEquals(16, response.getEntryList().size());
assertFalse(response.getEntryList().get(0).hasIndexKey());
assertEquals(response.getEntryList().get(0).getObjectKey().toString(), keyBase + "5");
query =
new SecondaryIndexQueryOperation.Query.Builder(ns, BinaryValue.unsafeCreate((indexName + "_int").getBytes()))
.withRangeStart(BinaryValue.unsafeCreate(String.valueOf(5L).getBytes()))
.withRangeEnd(BinaryValue.unsafeCreate(String.valueOf(20L).getBytes()))
.withReturnKeyAndIndex(true)
.withPaginationSort(true)
.build();
queryOp =
new SecondaryIndexQueryOperation.Builder(query)
.build();
cluster.execute(queryOp);
response = queryOp.get();
assertEquals(16, response.getEntryList().size());
assertTrue(response.getEntryList().get(0).hasIndexKey());
assertEquals(response.getEntryList().get(0).getIndexKey(), BinaryValue.unsafeCreate("5".getBytes()));
assertEquals(response.getEntryList().get(0).getObjectKey().toString(), keyBase + "5");
}