using 2i with protocol buffers
christian at basho.com
Fri Jul 19 04:22:55 EDT 2013
When using secondary indexes the index names must end in either `_int` for integer indexes or `_bin` for binary indexes in order for them to be recognised by the system . All indexes must be set when you write the objects.
You must also ensure that the bucket you are writing the objects to are using either the memory or leveldb backends as bitcask does not support secondary indexes. Can you verify that this is the case? Are there any error messages in the logs?
Which exact client version are you using?
On 19 Jul 2013, at 07:09, Joey Yandle <dragon at dancingdragon.be> wrote:
> Hi everbody,
> I'm using riak to store large numbers of FX rates, to allow for deep
> backtests of trading strategies. My code seems to be working, except
> that I don't get any keys back from 2i range requests.
> Here's the code which puts the rate into riak (the rate is itself a
> protocol buffers object):
> std::string s = p->rate().time();
> std::string rate;
> mrx::riak::RpbPutReqPtr req(new mrx::riak::RpbPutReq());
> mrx::riak::RpbContent* content = req->mutable_content();
> mrx::riak::RpbPair* index = content->add_indexes();
> Here's the code which does the index search:
> mrx::riak::RpbIndexReqPtr req(new mrx::riak::RpbIndexReq());
> I originally used the string "time" as the index key, and there was no
> error when doing the put command. However, when trying to search with
> this index, I got the following error:
> This error went away when I used "time_bin" as the index. However,
> regardless of what I use as the index key when doing the put, I never
> get any keys returned during the search.
> Can someone point me to a working example of using protocol buffers to
> do a put and subsequent index search? The examples online only show the
> riak-users mailing list
> riak-users at lists.basho.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the riak-users