diff options
| author | Robin Edwards <robin.ge@gmail.com> | 2011-08-08 12:17:47 +0100 |
|---|---|---|
| committer | Robin Edwards <robin.ge@gmail.com> | 2011-08-08 12:17:47 +0100 |
| commit | fbc19bcb8f001d5a9479bf89d3c466568c7943bf (patch) | |
| tree | 31d51b3af84ab9f2879ef2403139ca04cce7c7f3 /t | |
| parent | ammended error in synopsis (diff) | |
| parent | update changelog (diff) | |
| download | net-riak-fbc19bcb8f001d5a9479bf89d3c466568c7943bf.tar.gz | |
Merge branch 'master' of github.com:franckcuny/net-riak
Diffstat (limited to 't')
| -rw-r--r-- | t/20_search.t | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/t/20_search.t b/t/20_search.t new file mode 100644 index 0000000..b25e811 --- /dev/null +++ b/t/20_search.t @@ -0,0 +1,30 @@ +use lib 't/lib'; +use Test::More; +use Test::Riak; + +test_riak_rest { + my ($client, $bucket_name) = @_; + ok $client->setup_indexing($bucket_name), 'setup indexing ok'; + + ok my $bucket = $client->bucket($bucket_name), 'got bucket test'; + my $content = { field => "indexed" }; + + ok my $obj = $bucket->new_object(undef, $content), + 'created a new riak object without a key'; + ok $obj->store, 'store object without key'; + ok $obj->key, 'key created'; + + is $client->search( + index => $bucket_name, + wt => "json", + q => "field:indexed")->{response}->{docs}[0]->{id}, + $obj->key, + 'search with index in path'; + + is $client->search( + wt => "json", + q => "$bucket_name.field:indexed")->{response}->{docs}[0]->{id}, + $obj->key, + 'search with index prefixes in query'; + $obj->delete; +} |
