JSON-Encoding from riakc

Sean Cribbs sean at basho.com
Sun Jun 24 10:45:59 EDT 2012


Florian,

Also if your value is a proplist and you use the content-type of
"application/x-erlang-binary", then Search will automatically extract the
values as it does for JSON and XML.  See
https://github.com/basho/riak_search/blob/master/src/riak_search_kv_erlang_extractor.erl

On Sun, Jun 24, 2012 at 6:11 AM, Erik Søe Sørensen <ess at trifork.com> wrote:

> One answer is: dict:to_list/1 and dict:from_list may be your friends.
> Another is: Are you sure that dict is appropriate for your data? If the
> number of entries is bounded and does not exceed around a dozen, then a
> property list might be faster.
> (Although I'd advice you to use lists:keyfind(Key, 1, PropList) rather
> than proplist:get_value(); there's a significant speed difference.)
> Thirdly, you can of course translate to JSON and back, but keeping the
> data on Erlang term form is probably both simpler and faster.
>
> /Erik
>
> ________________________________________
> From: riak-users-bounces at lists.basho.com [
> riak-users-bounces at lists.basho.com] On Behalf Of Florian Odronitz [
> fo at twofloats.com]
> Sent: 23 June 2012 16:39
> To: riak-users at lists.basho.com
> Subject: JSON-Encoding from riakc
>
> Hello List,
>
> I am using the riak-erlang-client and I am trying to store JSON. Now the
> riak_pb_kv_codec module assumes that when using the erlang client one would
> always like to encode data in erlang binaries. Which is ok with me _until_
> riak_search needs to index this data.
> I know the indexing also works on erlang data but only until one uses
> proplists. But I use dicts in all my data structures...
> Any ideas about how to best proceed?
>
> Thanks,
> Florian
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>



-- 
Sean Cribbs <sean at basho.com>
Software Engineer
Basho Technologies, Inc.
http://basho.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20120624/d1e6d3c8/attachment.html>


More information about the riak-users mailing list