Update Riak Erlang PB client documentation #48

Closed
seancribbs opened this Issue Mar 28, 2012 · 1 comment

Comments

Projects
None yet
1 participant
Contributor

seancribbs commented Mar 28, 2012

Moved from https://issues.basho.com/show_bug.cgi?id=1035, reported by @rustyio

When indexing values in the Erlang pb client, the values must be converted to binary first (with term_to_binary/1) and the content type must be "application/x-erlang-binary". This is not clear in the docs.

Also, fields and values must be specified as binaries.

Example of doing it right:

F = fun(DB, Key, Value) ->
            {ok, Pid} = riakc_pb_socket:start_link("127.0.0.1", 8087),
            InsertObject = riakc_obj:new(list_to_binary(DB),
                                         list_to_binary(Key), 
                                         term_to_binary(Value),
                                         "application/x-erlang-binary"),
            riakc_pb_socket:put(Pid, InsertObject),    
            riakc_pb_socket:stop(Pid),
            {ok, insert_successful}
    end.

F("User","name",[{<<"fname">>,<<"Fname">>},{<<"lname">>,<<"Lname">>}]).
search:search("User", "fname:Fname").
Contributor

seancribbs commented May 30, 2014

Riak Search 1 is being deprecated, closing.

seancribbs closed this May 30, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment