riak-erlang-client search changes

Dave Parfitt diparfitt at gmail.com
Fri Aug 3 11:07:38 EDT 2012


Hello -
   
Instead of returning a tuple for Riak Search results, we'll return a record instead:

-record(search_results, {
          docs :: [search_doc()],         %% Result documents
          max_score :: float(),           %% Maximum score
          num_found :: non_neg_integer()  %% Number of results
         }).

Cheers -
Dave

On Aug 2, 2012, at 11:08 PM, Andrew Berman wrote:

> The more fields the better.   I like this change.
> 
> Andrew
> 
> On Aug 2, 2012 8:17 AM, "Dave Parfitt" <dparfitt at basho.com> wrote:
> Hello -
> We're considering some changes to the Riak Search functionality in riak-erlang-client for the upcoming Riak 1.2 release. The current behavior of the riakc_pb_socket:search/* functions return a list in the form: [[Index, Id],[Index2,Id2],...]
> 
> With the new Riak Search protobuffs messages, we have the ability to also return fields from the search doc in the results (as additional values in the tuple). Also, it's possible to return the search results "max score", and "number found". Does anyone have any objections to returning additional fields? To maintain semi-compatible behavior, it's possible to use the fl (field limit) search option to just return the id.
> 
> Current behavior:
> riakc_pb_socket:search(Pid, <<"phrases_custom">>, <<"phrase:fox">>).                
> {ok,[[<<"phrases_custom">>,<<"5">>],
>      [<<"phrases_custom">>,<<"1">>]]}
> 
> Proposed behavior:
> riakc_pb_socket:search(Pid, <<"phrases_custom">>, <<"phrase:fox">>).
> {ok,[{<<"phrases_custom">>,
>         [{<<"id">>,<<"1">>}, 
>          {<<"phrase">>,<<"The quick brown fox jumps over the lazy dog">>}],
>      {<<"phrases_custom">>,
>         [{<<"id">>,<<"5">>},
>         {<<"phrase">>,<<"The quick brown fox jumps over the lazy dog">>}],
>     0.0,2}
>     %% Note the last two fields of the result are Max Score and Number Found.
> 
> Semi-compatible behavior by specifying the fl (with the exception of max score and number found):
> riakc_pb_socket:search(Pid, <<"phrases_custom">>, <<"phrase:fox">>, [{fl,[<<"id">>]}], 5000, 5000).
> {ok,[{<<"phrases_custom">>,[{<<"id">>,<<"1">>}]},
>      {<<"phrases_custom">>,[{<<"id">>,<<"5">>}]},
>     0.0,2}
> 
> Cheers -
> Dave
> 
> 
> 
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20120803/8c2ba13f/attachment.html>


More information about the riak-users mailing list