Riak Search with Erlang API

Mathias Meyer mathias at basho.com
Mon May 30 10:00:02 EDT 2011


what the Protobufs client (which I assume is what you're using) does to get search results is to run a MapReduce job with the search as input.

You can easily use this to your advantage to achieve what you're after with a custom map function, example to follow. When Riak Search results are fed into the map phase, it receives the score in the keydata parameter, so you can just use an anonymous function to return both the Riak object and the key data, or extract the just score, as you see fit for your use case.

MapObjectKeydata = fun(RiakObject, KeyData, none) -> 
[RiakObject, KeyData]
Timeout = 100000.riakc_pb_socket:search(Pid, "bucket", "query", [{map, {qfun, MapObjectKeydata}, none, true}], Timeout).

Mathias Meyer
Developer Advocate, Basho Technologies

On Montag, 30. Mai 2011 at 12:37, Hagbard Celine wrote:

> Hi,
> im experimenting a little bit with Riak Search and want to query my node
> via Erlang API. But instead of the command line interface i got only a list
> of bucket/key pairs. Is there a way to get scoring information via Erlang
> API?
> Thanks
> Hagbard
> -- 
> Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
> belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com (mailto:riak-users at lists.basho.com)
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

More information about the riak-users mailing list