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

-- 

                
[1]

 ANTONIO ROHMAN FERNANDEZ
CEO, Founder & Lead
Engineer
roh...@mahalostudio.com [2]              
 PROJECTS
MaruBatsu.es
[3]
PupCloud.com [4]
Wedding Album [5] 

   

Links:
------
[1]
http://mahalostudio.com
[2] mailto:roh...@mahalostudio.com
[3]
http://marubatsu.es
[4] http://pupcloud.com
[5]
http://wedding.mahalostudio.com
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to