Hi,
I might not look hard enough - but I cannot find how to use
the secondary indices from the riakc erlang client interface.
No example and no manual.
I need a simple example how to write an indexed object
and also a simple example how to look it up via the index.
This is my own try to write and lookup an object
It does not work :)
----------------------------------------------------------
write_index(Pid) ->
Bucket = <<"persons">>,
Key = <<"bosse">>,
Index = {<<"lives">>, <<"sumatra">>},
Obj = riakc_obj:new(Bucket, Key, <<"1949">>),
Meta = dict:store(?MD_INDEX, Index, dict:new()),
Obj2 = riakc_obj:update_metadata(Obj, Meta),
riakc_pb_socket:put(Pid, Obj2).
----------------------------------------------------------
read_index(Pid) ->
Bucket = <<"persons">>,
Index = <<"lives">>,
IndexKey = <<"sumatra">>,
riakc_pb_socket:get_index(Pid, Bucket, Index, IndexKey).
----------------------------------------------------------
/Roland
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com