who can give me some idea 在 2012年8月30日星期四,郎咸武 写道:
> Hi guys, > I need your help. > > Version: > 1)riak-erlang-client-1.3 > 2)riak-1.2 > 3)Erlang R14B04 (erts-5.8.5) [source] [64-bit] > > This is my bucket attributs in the following > > ([email protected] <javascript:_e({}, 'cvml', '[email protected]');>)52> {ok,C} > = riak:local_client(). > > {ok,{riak_client,'[email protected] <javascript:_e({}, 'cvml', > '[email protected]');>',undefined}} > ([email protected] <javascript:_e({}, 'cvml', '[email protected]');>)53> > C:set_bucket(<<"user">>,[{precommit, > [{struct,[{<<"mod">>,<<"riak_search_kv_hook">>},{<<"fun">>,<<"precommit">>}]}]}]). > ok > ([email protected] <javascript:_e({}, 'cvml', '[email protected]');>)54> > C:get_bucket(<<"user">>). > > [{search,true}, > {allow_mult,false}, > {basic_quorum,false}, > {big_vclock,50}, > {chash_keyfun,{riak_core_util,chash_std_keyfun}}, > {dw,quorum}, > {last_write_wins,false}, > {linkfun,{modfun,riak_kv_wm_link_walker,mapreduce_linkfun}}, > {n_val,3}, > {name,<<"user">>}, > {notfound_ok,true}, > {old_vclock,86400}, > {postcommit,[]}, > {pr,0}, > * {precommit,[{struct,[{<<"mod">>,<<"riak_search_kv_hook">>},* > * {<<"fun">>,<<"precommit">>}]}]},* > {pw,0}, > {r,quorum}, > {rw,quorum}, > {small_vclock,50}, > {w,quorum}, > {young_vclock,20}] > > *------------------* > *In the client* > *To new a object and search it* > 147> f(O),O=riakc_obj:new(<<"user">>, <<"jason">>, <<"jasonlang">>) > 147> . > {riakc_obj,<<"user">>,<<"jason">>,undefined,[],undefined, > <<"jasonlang">>} > > 150> riakc_pb_socket:put(Pid,O). > ok > 151> riakc_pb_socket:search(Pid, <<"user">>, "jason*") > 151> . > {ok,{search_results,[{<<"user">>, > > [{<<"id">>,<<"jason">>},{<<"value">>,<<"jasonlang">>}]}], > 0.0,1}} > 152> > > *This search operator is ok* > > *TO new another object and search it* > > 152> f(O),O=riakc_obj:new(<<"user">>, <<"lang">>, <<"langzhe">>) > 152> . > {riakc_obj,<<"user">>,<<"lang">>,undefined,[],undefined, > <<"langzhe">>} > 153> riakc_pb_socket:put(Pid,O). > ok > 154> riakc_pb_socket:search(Pid, <<"user">>, "langzh*") > 154> . > {ok,{search_results,[{<<"user">>, > > [{<<"id">>,<<"lang">>},{<<"value">>,<<"langzhe">>}]}], > 0.0,1}} > *This is ok too* > * > * > *Search the objects:* > 157> riakc_pb_socket:search(Pid, <<"user">>, "langzh*\"\"jason*") > 157> . > {ok,{search_results,[{<<"user">>, > > [{<<"id">>,<<"jason">>},{<<"value">>,<<"jasonlang">>}]}, > {<<"user">>, > > [{<<"id">>,<<"lang">>},{<<"value">>,<<"langzhe">>}]}], > 0.0,2}} > 158> > This is ok too. > ------------------------------------------------------------------- > *In the above is ok.* > * > * > *I am sorry ,**the question in the following* > * > * > 159> f(O),O=riakc_obj:new(<<"user">>, <<"mine">>, > term_to_binary([{"name_","jason"},{"sex_", "male"}])). > {riakc_obj,<<"user">>,<<"mine">>,undefined,[],undefined, > <<131,108,0,0,0,2,104,2,107,0,5,110,97,109,101,95,107,0, > 5,106,97,115,...>>} > 160> riakc_pb_socket:put(Pid,O). > > ok > 161> riakc_pb_socket:search(Pid, <<"user">>, > term_to_binary([{"name_","jason"},{"sex_", "male"}])). > {ok,{search_results,[{<<"user">>, > [{<<"id">>,<<"mine">>}, > {<<"value">>, > > <<131,108,0,0,0,2,104,2,107,0,5,110,97,109,101,95,107, > 0,...>>}]}], > 0.35355299711227417,1}} > 162> riakc_pb_socket:search(Pid, <<"user">>, > term_to_binary([{"name_","jason"}])). > {ok,{search_results,[],0.0,0}} > 163> > *How to get the object by the {"name_", "jason"} ?* > *Is there another way to solve the question?* > > > > I need your help, thanks very much. > > Jason > > > > > > > > > > > > > > -- > 只为成功找方法,不为失败找理由 > -- 只为成功找方法,不为失败找理由
_______________________________________________ riak-users mailing list [email protected] http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
