Skip to content

Instantly share code, notes, and snippets.

@engelsanchez
Created May 22, 2013 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save engelsanchez/5630275 to your computer and use it in GitHub Desktop.
Save engelsanchez/5630275 to your computer and use it in GitHub Desktop.
Show dropped duplicates with return terms with new 2i pagination
(dev1@127.0.0.1)2> {ok, PB} = riakc_pb_socket:start("127.0.0.1", 10017).
{ok,<0.4627.0>}
(dev1@127.0.0.1)7> B = <<"bucket">>, O1 = riakc_obj:new(B, <<"1">>, <<"1">>).
(dev1@127.0.0.1)10> Md = riakc_obj:get_metadata(O1).
(dev1@127.0.0.1)11> Md2 = riakc_obj:set_secondary_index(Md, {{integer_index, "i1"}, [1,2,3]}).
(dev1@127.0.0.1)12> O2 = riakc_obj:update_metadata(O1, Md2).
(dev1@127.0.0.1)13> riakc_pb_socket:put(PB, O2).
(dev1@127.0.0.1)22> riakc_pb_socket:get_index_range(PB, B, "i1_int", 1,3, [{max_results, 3}, {return_terms, true}]).
{ok,[{results,[{<<"1">>,<<"1">>},
{<<"2">>,<<"1">>},
{<<"3">>,<<"1">>}]},
{continuation,<<"g2gCYQNtAAAAATE=">>}]}
(dev1@127.0.0.1)23> riakc_pb_socket:get_index_range(PB, B, "i1_int", 1,3, [{max_results, 2}, {return_terms, true}]).
{ok,[{results,[{<<"1">>,<<"1">>},{<<"2">>,<<"1">>}]},
{continuation,<<"g2gCYQJtAAAAATE=">>}]}
(dev1@127.0.0.1)24> riakc_pb_socket:get_index_range(PB, B, "i1_int", 1,3, [{max_results, 2}, {return_terms, true}, {continuation, <<"g2gCYQJtAAAAATE=">>}]).
{ok,{keys,[]}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment