Hi alezozov,

I was able to perform the exact steps you described without problems:

$ 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"}]}}'

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

And then search using:

$ bin/search-cmd search users words

Can you check the Riak logs for errors to help me diagnose what's going on
here?

Also, what version of Search are you using? If you pulled the code from
GitHub, you may want to try downloading a package or tarball from
http://downloads.basho.com/riak-search/CURRENT/ instead.

Best,
Rusty

On Thu, Apr 21, 2011 at 4:23 AM, alezozov <alezo...@gmail.com> wrote:

> 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'=>'alezo...@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.
> _______________________________________________
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to