public class RawIndexQuery extends SecondaryIndexQuery<BinaryValue,RawIndexQuery.Response,RawIndexQuery>
A RawIndexQuery is used when you are using raw bytes for your 2i keys. The parameters are provided as BinaryValue objects.
byte[] bytes = new byte[] { 1,2,3,4};
BinaryValue key = BinaryValue.create(bytes);
Namespace ns = new Namespace("my_type", "my_bucket");
RawIndexQuery q = new RawIndexQuery.Builder(ns, "my_index", Type._BIN, key).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.
byte[] bytes = new byte[] { 1,2,3,4};
BinaryValue key = BinaryValue.create(bytes);
Namespace ns = new Namespace("my_type", "my_bucket");
RawIndexQuery q = new RawIndexQuery.Builder(ns, "my_index", Type._BIN, key).build();
RiakFuture<RawIndexQuery.StreamingResponse, RawIndexQuery> streamingFuture =
client.executeAsyncStreaming(q, 200);
RawIndexQuery.StreamingResponse streamingResponse = streamingFuture.get();
for (RawIndexQuery.Response.Entry e : streamingResponse)
{
System.out.println(e.getRiakObjectLocation().getKey().toString());
}
// 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 |
RawIndexQuery.Builder
Builder used to construct a RawIndexQuery command.
|
static class |
RawIndexQuery.Response |
SecondaryIndexQuery.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.Type
StreamableRiakCommand.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, timeout
Modifier | Constructor and Description |
---|---|
protected |
RawIndexQuery(SecondaryIndexQuery.Init<BinaryValue,?> builder) |
Modifier and Type | Method and Description |
---|---|
protected SecondaryIndexQuery.IndexConverter<BinaryValue> |
getConverter() |
buildCoreOperation, convertInfo, convertResponse, createResponse, equals, getContinuation, getIndexName, getMatchValue, getMaxResults, getNamespace, getPaginationSort, getRangeEnd, getRangeStart, getReturnKeyAndIndex, getTermFilter, getTimeout, hashCode, toString
buildCoreOperation, executeAsyncStreaming
executeAsync
execute, execute
protected RawIndexQuery(SecondaryIndexQuery.Init<BinaryValue,?> builder)
protected SecondaryIndexQuery.IndexConverter<BinaryValue> getConverter()
getConverter
in class SecondaryIndexQuery<BinaryValue,RawIndexQuery.Response,RawIndexQuery>
Copyright © 2016. All rights reserved.