On Oct 20, 2011, at 8:35 PM, Antonio Rohman Fernandez wrote: > Hi All, > > Imagine that I store "some_item" with key "some_key" into a "products" bucket > with a category "whatever" and a price "300". > I save it using cURL like this: > > $data = 'some_item'; > $key = 'some_key'; > $bucket = 'products'; > curl_setopt($curl, CURLOPT_HTTPHEADER, array("x-riak-index-price_int: > 300", "x-riak-index-categroy_bin: whatever")); > curl_setopt($curl, CURLOPT_URL, > "http://{$riakserver}:8098/riak/{$bucket}/{$key}"); > $method = 'PUT'; > [...] > > It works great and "GET > http://{$riakserver}:8098/buckets/products/index/category_bin/whatever" give > the correct data: > > {"keys": ["some_key"]} > > Now my question is... if i want to UPDATE the "price" from 300 to 400 but at > this moment i don't know the "category"... how do i retrieve which indexes > are set for a key? so I can update "price" and don't lose "category". > > If I do "GET http://{$riakserver}:8098/riak/products/some_key" I just get > "some_item" that is the data stored in the object, but I'm unable to see its > indexes.
I don't know if there's a better way, but you can always store the secondary index items in the value for that key. Use JSON or something to aggregate multiple items for the value, then looking up the key gives you the price in addition to "some_item". -Nate _______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com