1

I am using Java client for Riak KV 2.1.1. After creating index and applying it to Namespace, I am getting the no suitable method found error even though I am following the documentation given on the website. What is the solution for this?

Thanks.

Please see the code and the full error below.

        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

Error Image

Ateeq
  • 520
  • 1
  • 5
  • 17

1 Answers1

2

This is a documentation bug. RiakClient.execute() accepts an instance of RiakCommand, while StoreBucketPropsOperation is a lower-level API.

Instead, use the StoreBucketProperties command as follows:

    StoreBucketProperties storePropsCommand = new StoreBucketProperties.Builder(streets)
            .withSearchIndex("famous")
            .build();
    client.execute(storePropsCommand);
vempo
  • 3,093
  • 1
  • 14
  • 16
  • Yeah I tried that before posting the question, it won't give you the error but my Search query is not working after applying index. Its a simple key value (string, string) bucket. it gives may error. "Query cannot be completed".--------------------------------- SearchOperation searchOp = new SearchOperation .Builder(BinaryValue.create("famous"), "My home *") .build(); cluster.execute(searchOp); List>> results = searchOp.get().getAllResults(); – Ateeq May 27 '17 at 16:59
  • This is not what you asked. Actually, your original question is not even related to querying, but to associating an index with a bucket. As I explained, you should use the command API, which works in the same way as the operation API. If you have a different problem, post a different question. – vempo May 27 '17 at 17:31