diff options
author | Mainframe2008 <thg.bot@gmail.com> | 2013-02-26 08:44:28 +0100 |
---|---|---|
committer | Mainframe2008 <thg.bot@gmail.com> | 2013-02-26 08:44:28 +0100 |
commit | 1b442767f0bc92b98c3a398dde02dae6212ecd1c (patch) | |
tree | 103131ad787226886342fa39d44317ce9438c5e1 /lib/Net/Riak/Role/REST/Search.pm | |
parent | Add documentation for secondary indexes (diff) | |
download | net-riak-1b442767f0bc92b98c3a398dde02dae6212ecd1c.tar.gz |
*Added secondary index support using method names from the riak python
client. * Added tests for secondary indexes * Added documentation
Diffstat (limited to 'lib/Net/Riak/Role/REST/Search.pm')
-rw-r--r-- | lib/Net/Riak/Role/REST/Search.pm | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/Net/Riak/Role/REST/Search.pm b/lib/Net/Riak/Role/REST/Search.pm index 7e74af5..f813578 100644 --- a/lib/Net/Riak/Role/REST/Search.pm +++ b/lib/Net/Riak/Role/REST/Search.pm @@ -74,21 +74,27 @@ sub setup_indexing { JSON::decode_json($http_response->content); } -sub i2search { - my $self = shift; - my %params = @_; +sub index { + my ($self, $bucket,$index,$first, $last) = @_; + my $request; + my @req = (); my $org_prefix = $self->prefix; - - $request = $self->new_request('GET', [ + if ( defined($bucket) && defined($index) && defined($first) ) + { + @req = ( 'buckets', - $params{bucket}, - 'index', - $params{index}, - $params{key} - ] - ); + $bucket, + 'index', + $index, + $first + ); + + if ( defined($last) ) { push(@req, $last); } + } + + $request = $self->new_request('GET', [ @req ] ); my $http_response = $self->send_request($request); JSON::decode_json($http_response->content)->{keys}; |