1

我正在为 Riak KV 2.1.1 使用 Java 客户端。创建索引并将其应用到命名空间后,即使我遵循网站上给出的文档,我也得到了找不到合适的方法错误。解决方案是什么?

谢谢。

请参阅下面的代码和完整错误。

        YokozunaIndex famousIndex = new YokozunaIndex("famous", "_yz_default");
        StoreIndex storeIndex = new StoreIndex.Builder(famousIndex)
                .build();
        client.execute(storeIndex);    
        Namespace streets=new Namespace("streets");
        StoreBucketPropsOperation storePropsOp = new StoreBucketPropsOperation.Builder(streets)
                .withSearchIndex("famous")
                .build();
        client.execute(storePropsOp); // this is where I am getting error

错误图像

4

1 回答 1

2

这是一个文档错误。RiakClient.execute()接受RiakCommand, while的实例StoreBucketPropsOperation是一个较低级别的 API。

相反,使用StoreBucketProperties如下命令:

    StoreBucketProperties storePropsCommand = new StoreBucketProperties.Builder(streets)
            .withSearchIndex("famous")
            .build();
    client.execute(storePropsCommand);
于 2017-05-22T09:07:08.857 回答