Hello Antonio,

Firstly, please always reply to the list and not via personal email.

In regards to your question, I wrote a test that showcases how to write objects 
with tags in pb for search: 
https://github.com/basho/yokozuna/pull/479/files#diff-f9f0e102b2a5208f41b2f304ada0ee5cR306
 
<https://github.com/basho/yokozuna/pull/479/files#diff-f9f0e102b2a5208f41b2f304ada0ee5cR306>.
 It’s a bit of a workaround, needing the ‘x-riak-meta*’, which gets stripped in 
preparation for query, but it does work.

Please make sure you’ve also created an index and associated it with a 
bucket_type/bucket, i.e. 
http://docs.basho.com/riak/latest/dev/using/search/#Simple-Setup 
<http://docs.basho.com/riak/latest/dev/using/search/#Simple-Setup>. To query, 
it’d be the same as in the docs (field:*query*): 
http://docs.basho.com/riak/latest/dev/using/search/#Querying 
<http://docs.basho.com/riak/latest/dev/using/search/#Querying>.

Thanks.

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

> On Apr 7, 2015, at 4:28 AM, Antonio Teixeira <[email protected]> wrote:
> 
> Hi ,
> 
> I've been experimenting with with Riak Search and Tags but I've reached a 
> dead-end. I can't find any documentation on Querying Tags, I have followed 
> your example at: 
> https://github.com/basho/riak-erlang-client/blob/7487c90275c88dbe8ef4c2fed6540864364ca3d4/src/riakc_...
>  
> <https://github.com/basho/riak-erlang-client/blob/7487c90275c88dbe8ef4c2fed6540864364ca3d4/src/riakc_pb_socket.erl#L3348>
> Here is my Code:
> 
> O0 = riakc_obj:new(<<"test">>, <<"key0">>, <<"value0">>),
> MD0 = riakc_obj:get_update_metadata(O0),
> MD1 = riakc_obj:set_user_metadata_entry(MD0, {<<"ola_s">>,<<"nuno">>}),
> O1 = riakc_obj:update_metadata(O0, MD1),
> ok = riakc_pb_socket:put(Pid, O1).
> 
> My question is, how do I query this data without knowing the Key of the 
> Object.
> 
> Regards
> Antonio
> 
> 2015-04-02 16:10 GMT+01:00 Zeeshan Lakhani <[email protected] 
> <mailto:[email protected]>>:
> 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 
> <http://paperswelove.org/>
> twitter => @zeeshanlakhani
> 
>> On Apr 2, 2015, at 5:24 AM, Antonio Teixeira <[email protected] 
>> <mailto:[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