Hello Antonio, 

You can insert an object and tag in the same operation, and you can query on 
that tag via Riak Search.

Before writing the object, just apply/set the metadata accordingly. Here’s an 
example in the Erlang client: 
https://github.com/basho/riak-erlang-client/blob/7487c90275c88dbe8ef4c2fed6540864364ca3d4/src/riakc_pb_socket.erl#L3348
 
<https://github.com/basho/riak-erlang-client/blob/7487c90275c88dbe8ef4c2fed6540864364ca3d4/src/riakc_pb_socket.erl#L3348>.
 

Also, this can be done via http: 
https://github.com/basho/yokozuna/blob/5868266b11f131d14c85495e50f899f3fe8158ba/riak_test/yokozuna_essential.erl#L281
 
<https://github.com/basho/yokozuna/blob/5868266b11f131d14c85495e50f899f3fe8158ba/riak_test/yokozuna_essential.erl#L281>.

Thanks.

Zeeshan Lakhani
programmer | 
software engineer at @basho | 
org. member/founder of @papers_we_love | paperswelove.org
twitter => @zeeshanlakhani

> On Apr 2, 2015, at 5:24 AM, Antonio Teixeira <[email protected]> wrote:
> 
> I've been using Riak as my main database for a few months, now I've been 
> experimenting with Riak Search 2.0 and for what I read in your documentation 
> there is no way to insert a object and tag it in the same operation.
> Right now we have an opaque object and we query them through secondary 
> indexes, this is becoming unbearable.
>  What we need is to store an object and 
> tag(https://github.com/basho/yokozuna/blob/develop/docs/TAGGING.md 
> <https://github.com/basho/yokozuna/blob/develop/docs/TAGGING.md>) it all in 
> one step.
> Our objects consist of erlang dictionaries and it would be a bit expensive 
> (performance wise) to convert the Dictionary to a list and then to json in 
> every database related operation.
> We are using Riak 2.0.5, Erlang 17.0 and the PB Driver.

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

Reply via email to