* @see
* com.basho.riak.client.raw.RawClient#fetchIndex(com.basho.riak.client.
* raw.query.IndexQuery)
*/
public List<String> fetchIndex(IndexQuery indexQuery) throws IOException {
final MapReduce mr = new IndexMapReduce(this, indexQuery);
mr.addReducePhase(NamedErlangFunction.REDUCE_IDENTITY, new Object() {
@Override public String toString() {
return "{reduce_phase_only_1, true}";
}
});
// only return the key, to match the http rest api
mr.addReducePhase(new JSSourceFunction("function(v) { return v.map(function(e) { return e[1]; }); }"));
try {
MapReduceResult result = mr.execute();
return new ArrayList<String>(result.getResult(String.class));
} catch (RiakException e) {
throw new IOException(e);
}
}