riak kv search problem

alezozov alezozov at gmail.com
Thu Apr 21 04:23:06 EDT 2011


I'm trying to use auto index of bucket's objects.

First I allow Riak to do it for some bucket

*curl -X PUT http://192.168.1.100:8098/riak/users/
-H "Content-Type: application/json"
-d
'{"props":{"precommit":[{"mod":"riak_search_kv_hook","fun":"precommit"}]}}'*

then putting some kv record in this bucket

curl -X PUT http://192.168.1.100:8098/riak/users/test -H "Content-Type:
text/plain" -d  "here are some words"

but getting error:

*PUT aborted by pre-commit hook.*

i tried a piece of code

require_once 'riak.php';
$client = new Riak();
$bucket = $client->bucket('users');

$user = $bucket->newObject('alezozov3',
array('name'=>'alezozov',
'mail'=>'alezozov at mail.ru',
));
$user->setContentType('application/json');
$user->store();

//
//$aluser = $bucket->get('alezozov');
//if($aluser){
// if($aluser->getData()){
// print_r($aluser->getData());
// }
// else{
// echo '0';
// }

//}

$results = $client->search("users", "name:alezozov")->run();
if($results){
print_r($results);
}
else{
echo '-';
}

but getting message :

*Fatal error: Uncaught exception 'Exception' with message 'Expected status
200 or 201 or 300, received 403' in
/opt/lampp/htdocs/lib/php/riak_lib.php:1206 Stack trace: #0
/opt/lampp/htdocs/lib/php/riak_lib.php(1102): RiakObject->populate(Array,
Array) #1 /opt/lampp/htdocs/test/index.php(15): RiakObject->store() #2
{main} thrown in /opt/lampp/htdocs/lib/php/riak_lib.php on line 1206*

but if I don't use

*url -X PUT http://192.168.1.100:8098/riak/users/
-H "Content-Type: application/json"
-d
'{"props":{"precommit":[{"mod":"riak_search_kv_hook","fun":"precommit"}]}}*'

everything ok, and I can store and get objects, with command line and php
code, but of cource can't search

what I doing wrong ? where to dig?

thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20110421/4a957020/attachment.html>


More information about the riak-users mailing list