Big thanks! Drew. I was just cracking my head wondering what went wrong. I 
didn't realize that it must be binary. I do want to save proplist directly.

Cheer!

--
Hao
  

At 2015-08-09 01:54:44, "Drew Kerrigan" <d...@kerrigan.io> wrote:

Hello Hao,


Riak object values must be supplied to Riak as binary, are you attempting to 
store the proplist using term_to_binary/1? If so, you would need to create a 
custom search extractor for your values. Here is a small tutorial on creating 
extractors for yokozuna: 
http://docs.basho.com/riak/latest/dev/search/custom-extractors/


If you don't require the value to be specifically a proplist, a simpler 
solution would be to convert your proplist to JSON which already has an 
extractor built into RIak Search. A good module for JSON encoding / decoding is 
mochijson2 which comes with the https://github.com/mochi/mochiweb repo.


> SimpleProplist = [{key1, <<"value1">>}, {key2, <<"value2">>}].
...
> mochijson2:encode(SimpleProplist).
...
> RiakObjectValue = 
> list_to_binary(lists:flatten(mochijson2:encode(SimpleProplist))).
<<"{\"key1\":\"value1\",\"key2\":\"value2\"}">>


Cheers!
Drew


On Sat, Aug 8, 2015 at 2:06 AM Hao <jusf...@163.com> wrote:

If I want to save Erlang proplist into Riak and use Riak Search 2.0, do I need 
to create a Erlang Proplist extractor for solr to be able to index it?


--
Hao

  
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to