summaryrefslogtreecommitdiff
path: root/lib/Net/Riak/Role/REST/Search.pm
diff options
context:
space:
mode:
authorRobin Edwards <robin.ge@gmail.com>2013-03-01 02:04:58 -0800
committerRobin Edwards <robin.ge@gmail.com>2013-03-01 02:04:58 -0800
commit5f99cd866eb23113ea46ac78720f5608c54982ce (patch)
tree3c35ac04f3d748942c2e973e6f42164ff02e4316 /lib/Net/Riak/Role/REST/Search.pm
parentUpdate changelog (diff)
parent*Added secondary index support using method names from the riak python (diff)
downloadnet-riak-5f99cd866eb23113ea46ac78720f5608c54982ce.tar.gz
Merge pull request #22 from Mainframe2008/master
Secondary index support
Diffstat (limited to '')
-rw-r--r--lib/Net/Riak/Role/REST/Search.pm27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/Net/Riak/Role/REST/Search.pm b/lib/Net/Riak/Role/REST/Search.pm
index b83e3d4..f813578 100644
--- a/lib/Net/Riak/Role/REST/Search.pm
+++ b/lib/Net/Riak/Role/REST/Search.pm
@@ -1,6 +1,7 @@
package Net::Riak::Role::REST::Search;
use Moose::Role;
use JSON;
+use Data::Dumper;
#ABSTRACT: Search interface
@@ -73,4 +74,30 @@ sub setup_indexing {
JSON::decode_json($http_response->content);
}
+sub index {
+ my ($self, $bucket,$index,$first, $last) = @_;
+
+ my $request;
+ my @req = ();
+
+ my $org_prefix = $self->prefix;
+ if ( defined($bucket) && defined($index) && defined($first) )
+ {
+ @req = (
+ 'buckets',
+ $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};
+}
+
1;