Riak Search.

Chris Cook cookchrisd at gmail.com
Thu Dec 1 06:29:01 EST 2011


Hi,

Sorry, but I've done a lot of googling and haven't been to work out where
this is going wrong, could someone please point out where I may be going
wrong with it. I have riak search enabled and set to true and riak clusters
all restarted. I go through the following steps below using
riak-erlang-http-client, but whenever I do a search I get {ok, []} back.

Erlang R14B02 (erts-5.8.3) [source] [rq:1] [async-threads:0]
[kernel-poll:false]

Eshell V5.8.3  (abort with ^G)
1> [ ok = application:start(A) || A <- [sasl, ibrowse] ],
1> IP = "127.0.0.1",
1> Port = 8098,
1> Prefix = "riak",
1> Options = [],
1> C = rhc:create(IP, Port, Prefix, Options).

---- Snipped Progress Reports from here, everything start with ok ----

{rhc,"127.0.0.1",8098,"riak",[{client_id,"At5+Yg=="}]}
2> rhc:set_bucket(C, "my_books", [{<<"precommit">>, [{struct, [{<<"mod">>,
<<"riak_search_kv_hook">>}, {<<"fun">>,<<"precommit">>}]}]}]).

=PROGRESS REPORT==== 1-Dec-2011::11:13:43 ===
          supervisor: {local,inet_gethost_native_sup}
             started: [{pid,<0.53.0>},{mfa,{inet_gethost_native,init,[[]]}}]

=PROGRESS REPORT==== 1-Dec-2011::11:13:43 ===
          supervisor: {local,kernel_safe_sup}
             started: [{pid,<0.52.0>},
                       {name,inet_gethost_native_sup},
                       {mfargs,{inet_gethost_native,start_link,[]}},
                       {restart_type,temporary},
                       {shutdown,1000},
                       {child_type,worker}]
ok
3> PropList = [{<<"id">>, <<"123456789">>},{<<"title">>, <<"The Title">>},
{<<"content">>, <<"The Content">>}].
[{<<"id">>,<<"123456789">>},
 {<<"title">>,<<"The Title">>},
 {<<"content">>,<<"The Content">>}]
4> Obj = riakc_obj:new("my_books", <<"123456789">>, PropList,
list_to_binary("application/x-erlang-term")).
{riakc_obj,"my_books",<<"123456789">>,undefined,[],
           {dict,1,16,16,8,80,48,
                 {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],...},

{{[],[],[],[],[],[],[],[],[],[],[[<<...>>|...]],[],[],...}}},
           [{<<"id">>,<<"123456789">>},
            {<<"title">>,<<"The Title">>},
            {<<"content">>,<<"The Content">>}]}
5> rhc:put(C, Obj).
ok
6> rhc:search(C, "my_books", <<"content:The Content">>).
{ok,[]}
7> rhc:search(C, <<"my_books">>, <<"content:The Content">>).
{ok,[]}
8> {ok, Obj0} = rhc:get(C, <<"123456789">>).
** exception error: undefined function rhc:get/2
9> {ok, Obj0} = rhc:get(C, "my_books", <<"123456789">>).
{ok,{riakc_obj,"my_books",<<"123456789">>,
               <<107,206,97,96,96,96,204,96,202,5,82,28,202,156,255,126,
                 250,45,186,178,45,131,41,...>>,
               [{{dict,3,16,16,8,80,48,
                       {[],[],[],[],[],[],[],[],[],[],[],[],...},
                       {{[],[],[],[],[],[],[],[],[],[],...}}},
                 <<131,108,0,0,0,3,104,2,109,0,0,0,2,105,100,109,0,0,0,
                   ...>>}],
               undefined,undefined}}
10>

It's probably something to do with the content type, but I'm really unsure,
many thanks in advance Chris.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20111201/95efab02/attachment-0001.html>


More information about the riak-users mailing list