riak search and basic write operations

kamiseq kamiseq at gmail.com
Wed Oct 3 12:24:21 EDT 2012


ok,
I admit that somehow I didn't catch at first that example shows second
index usage - so thanks for pointing this out.

what about questions 1,4,5??

pozdrawiam
Paweł Kamiński

kamiseq at gmail.com
pkaminski.prv at gmail.com
______________________


On 3 October 2012 00:24, Brian Roach <roach at basho.com> wrote:
> Greetings!
>
> First and foremost, search and secondary indexes (2i) are not the same thing.
>
> You need to enable 2i and use the ELevelDB backend as described here:
> http://wiki.basho.com/Secondary-Indexes---Configuration-and-Examples.html
>
> Secondly, the default Converter (JSONConverter) in the Java client
> does support serializing/deserializing of secondary indexes. The page
> you link to in the cookbook is demonstrating how to write your own
> custom converter (for something other than JSON), and its first
> example does not support them.
>
> Enable 2i in Riak, annotate your POJO as you have, and use the default
> Converter and you should be fine; nothing else is needed.
>
> On Tue, Oct 2, 2012 at 4:03 PM, kamiseq <kamiseq at gmail.com> wrote:
>> hej I am a bit confused about search functionality and basic
>> read/write operations.
>>
>> Im using recent (1.0.6) java client and pb cluster riak client. just
>> for testing Im only using two local machines joined into one cluster.
>> storing and reading objects works fine  with key(let say I have users
>> bucket and I generate id from timestamp).
>>
>> but
>> 1. I cannot fetch objects using rest client in firefox after I store
>> objects using java client (I ll check with curl) but I can query for
>> keys in bucket (http://192.168.0.121:8098/riak/users/?keys=true&props=false).
>> 2. I followed https://github.com/basho/riak-java-client/wiki/Using-a-custom-Converter
>> and I annotated one of the field with @RiakIndex(name = "user_email")
>> and now I tried to look-up this object with email but I got
>> Caused by: com.basho.riak.client.RiakException: java.io.IOException:
>> {"phase":"index","error":"{indexes_not_supported,riak_kv_bitcask_backend}","input":"{cover,[{1370157784997721485815954530671515330927436759040,[1370157784997721485815954530671515330927436759040]}],{<<\"users\">>,{eq,<<\"user_email_bin\">>,<<\"js at gm.com1\">>}}}","type":"result","stack":"[]"}
>>     at com.basho.riak.client.query.MapReduce.execute(MapReduce.java:80)
>>     at com.basho.riak.client.raw.pbc.PBClientAdapter.fetchIndex(PBClientAdapter.java:436)
>>
>> I ve google a bit and all I could find was this
>> http://lists.basho.com/pipermail/riak-users_lists.basho.com/2011-September/005749.html
>> post a year old now. which points out that search needs to be enabled
>> in app.config file. I changed settings and restarted both machines.
>> but I keep getting same exception every time.
>> 3. in same https://github.com/basho/riak-java-client/wiki/Using-a-custom-Converter
>> tutorial I read that default converter is not marshalling indexes,
>> links and metadata and it shows how to get and restore those
>> information back but looking into code for default converter
>> implementation I could find the same lines of code as in the article
>>
>> Map<String, String> usermetaData =
>> usermetaConverter.getUsermetaData(domainObject);
>>         RiakIndexes indexes = riakIndexConverter.getIndexes(domainObject);
>>         Collection<RiakLink> links = riakLinksConverter.getLinks(domainObject);
>>
>>         return RiakObjectBuilder.newBuilder(bucket, key)
>>             .withValue(value)
>>             .withVClock(vclock)
>>             .withUsermeta(usermetaData)
>>             .withIndexes(indexes)
>>             .withLinks(links)
>>             .withContentType(Constants.CTYPE_OCTET_STREAM)
>>             .build();
>> 4. can I specify data encoding it seems that it is not UTF-8
>> 5. I also saw in app.config that vnode_vclocks is set to true, so
>> should I still set clientId on riak client?? I read it will be skipped
>> anyway now.
>>
>> thanks for any comments
>>
>> pozdrawiam
>> Paweł Kamiński
>>
>> kamiseq at gmail.com
>> pkaminski.prv at gmail.com
>> ______________________
>>
>> _______________________________________________
>> riak-users mailing list
>> riak-users at lists.basho.com
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com




More information about the riak-users mailing list