The indexes will be returned as headers in the response. Check the response for the "x-riak-index-categroy_bin" header.
Thanks, Dan Daniel Reverri Developer Advocate Basho Technologies, Inc. [email protected] On Thu, Oct 20, 2011 at 9:43 PM, Antonio Rohman Fernandez < [email protected]> wrote: > ** > > Hi Nate, > > Thanks for your answer... I also thought of that, having the values as a > JSON object inside the data... but I was hoping there was some way to check > the indexes without having to put more data into the objects. > > Thanks > > On Thu, 20 Oct 2011 21:38:58 -0700, Nate Lawson wrote: > > 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 > > > -- > [image: line] [image: logo] <http://mahalostudio.com> *Antonio Rohman > Fernandez* > CEO, Founder & Lead Engineer > [email protected] *Projects* > MaruBatsu.es <http://marubatsu.es> > PupCloud.com <http://pupcloud.com> > Wedding Album <http://wedding.mahalostudio.com> [image: line] > > _______________________________________________ > riak-users mailing list > [email protected] > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com > >
_______________________________________________ riak-users mailing list [email protected] http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
