Riak搜索返回null

时间:2013-03-28 13:43:46

标签: php nosql riak riak-search

我正在尝试与Riak合作开发PHP。我看了文档,但没有运气。所以我已经将/etc/init.d/app.conf中的“搜索”选项配置为true。因此,print_r($ results)返回null数组。

# Connect to Riak
$client = new RiakClient('127.0.0.1', 8098);

$bucket = $client->bucket("searchbucket");
$bucket->newObject("one", array("foo"=>"one", "bar"=>"red"))->store();
$bucket->newObject("two", array("foo"=>"two", "bar"=>"green"))->store();

# Execute a search for all objects with matching properties
$results = $client->search("searchbucket", "foo:one OR foo:two")->run();


print_r($results);

我的代码出了什么问题?我误解了什么?

1 个答案:

答案 0 :(得分:3)

除了在app.config文件中启用搜索外,您还需要为要搜索的存储桶显式启用它。这可以通过adding a Riak Search commit hook to the bucket properties.

完成

如果您为' searchbucket'检索bucket properties你应该能够看到列出的提交钩子。