public class KeyIndexQuery extends RawIndexQuery
A KeyIndexQuery is used when you want to fetch a range of keys for a bucket. A namespace and a key range is needed.
Namespace ns = new Namespace("my_type", "my_bucket");
KeyIndexQuery q = new KeyIndexQuery.Builder(ns, "foo10", "foo19").build();
RawIndexquery.Response resp = client.execute(q);
You can also stream the results back before the operation is fully complete.
This reduces the time between executing the operation and seeing a result,
and reduces overall memory usage if the iterator is consumed quickly enough.
The result iterable can only be iterated once though.
If the thread is interrupted while the iterator is polling for more results,
a RuntimeException will be thrown.
Namespace ns = new Namespace("my_type", "my_bucket");
KeyIndexQuery q = new KeyIndexQuery.Builder(ns, "foo10", "foo19").build();
RiakFuture<RawIndexQuery.StreamingResponse, RawIndexQuery> streamingFuture =
client.executeAsyncStreaming(q, 200);
RawIndexQuery.StreamingResponse streamingResponse = streamingFuture.get();
for (BinIndexQuery.Response.Entry e : streamingResponse)
{
System.out.println(e.getRiakObjectLocation().getKeyAsString());
}
// Wait for the command to fully finish.
streamingFuture.await();
// The StreamingResponse will also contain the continuation, if the operation returned one.
streamingResponse.getContinuation();
| Modifier and Type | Class and Description |
|---|---|
static class |
KeyIndexQuery.Builder |
RawIndexQuery.ResponseSecondaryIndexQuery.GatherableResponseCreator<T,R extends SecondaryIndexQuery.Response<T,?>>, SecondaryIndexQuery.IndexConverter<T>, SecondaryIndexQuery.Init<S,T extends SecondaryIndexQuery.Init<S,T>>, SecondaryIndexQuery.StreamableResponseCreator<T,R extends SecondaryIndexQuery.Response<T,?>>, SecondaryIndexQuery.TypeStreamableRiakCommand.StreamableResponse<T,S>, StreamableRiakCommand.StreamableRiakCommandWithSameInfo<R extends StreamableRiakCommand.StreamableResponse,I,CoreR>GenericRiakCommand.GenericRiakCommandWithSameInfo<R,I,CoreR>continuation, coverageContext, end, indexName, match, maxResults, namespace, paginationSort, returnBody, returnTerms, start, termFilter, timeoutgetConverterbuildCoreOperation, convertInfo, convertResponse, createResponse, equals, getContinuation, getIndexName, getMatchValue, getMaxResults, getNamespace, getPaginationSort, getRangeEnd, getRangeStart, getReturnKeyAndIndex, getTermFilter, getTimeout, hashCode, toStringbuildCoreOperation, executeAsyncStreamingexecuteAsyncexecute, executeCopyright © 2016. All rights reserved.