From 2fd683a151a9a4bdaf64d44468fbde4fa5226602 Mon Sep 17 00:00:00 2001 From: Mainframe2008 Date: Fri, 1 Feb 2013 12:46:04 +0100 Subject: Added support for searching with secondary indexes --- lib/Net/Riak/Search.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/Net/Riak/Search.pm') diff --git a/lib/Net/Riak/Search.pm b/lib/Net/Riak/Search.pm index ee2ed57..646d4d3 100644 --- a/lib/Net/Riak/Search.pm +++ b/lib/Net/Riak/Search.pm @@ -33,6 +33,13 @@ sub setup_indexing { $bucket->delete_object($key, 3); # optional w val + # Secondary index setup + my $obj3 = $bucket->new_object('foo3', {...}); + $obj3->i2index({ myindex_bin => 'myvalue' }); + $obj3->store; + + my @keys = $client->i2search(bucket => 'foo', index => 'myindex_bin', key => 'myvalue' ); + =head1 DESCRIPTION L allows you to enable indexing documents for a given bucket and querying/searching the index. @@ -80,6 +87,15 @@ is the default index you want to query, if no index is provided you have to add is the number of documents you want to be returned in the response +=item i2index + +add secondary index to object + +=item i2search + +Find keys via secondary index. + + =back More parameters are available, just check at L -- cgit v1.2.3 From 1b442767f0bc92b98c3a398dde02dae6212ecd1c Mon Sep 17 00:00:00 2001 From: Mainframe2008 Date: Tue, 26 Feb 2013 08:44:28 +0100 Subject: *Added secondary index support using method names from the riak python client. * Added tests for secondary indexes * Added documentation --- lib/Net/Riak/Search.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/Net/Riak/Search.pm') diff --git a/lib/Net/Riak/Search.pm b/lib/Net/Riak/Search.pm index 646d4d3..368b7e7 100644 --- a/lib/Net/Riak/Search.pm +++ b/lib/Net/Riak/Search.pm @@ -35,10 +35,10 @@ sub setup_indexing { # Secondary index setup my $obj3 = $bucket->new_object('foo3', {...}); - $obj3->i2index({ myindex_bin => 'myvalue' }); + $obj3->add_index('index', 'first'); $obj3->store; - my @keys = $client->i2search(bucket => 'foo', index => 'myindex_bin', key => 'myvalue' ); + my @keys = $client->index('bucket', 'myindex_bin', 'first_value' [, 'last_value'] ); =head1 DESCRIPTION @@ -87,11 +87,15 @@ is the default index you want to query, if no index is provided you have to add is the number of documents you want to be returned in the response -=item i2index +=item add_index add secondary index to object -=item i2search += item remove_index + +remove secondary index from object + +=item index Find keys via secondary index. -- cgit v1.2.3