Hi,

I've written a map reduce query on the riak java client like so...

client.mapReduce(BUCKET).addKeyFilter(keyFilter)
                    .addLinkPhase(BUCKET, "_", false)
                    .addMapPhase(new NamedJSFunction("Riak.mapValuesJson"),
false)
                    .addReducePhase(phaseFunction).execute();
Collection<MyType> types = result.getResult(MyType.class);

This is the class definition for MyType

public class MyType
{
    @RiakKey
    private String myKey;
    private String property1;
    private String property2;

    /*  Getters / Setters go here */
}

When the object mapper deserializes the results into Collection<MyType>,
none of the types have the myKey property populated in them. When I
debugged the calls made by riak I realized that the result of the /mapred
call does not contain any key information in the body. It only contains the
value that each key represents. So that explains why the keys are null in
the result.

On the contrary, a link walk in riak returns the Location header for each
multipart form entry in the response (Location: /riak/bucket/key). So I
guess there is at least some way to tweak a client to parse the location to
get the keys, but you lose out on the map-reduce goodness.

Is there some way a map-reduce query can be formed to allow the resulting
type's RiakKey to be populated ? What are my options ?

Thanks
Deepak Bala
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to