basho / riak-java-client

The Riak client for Java.
Apache License 2.0
267 stars 158 forks source link

IndexMapReduce returning empty list #709

Open lukasz-gosiewski opened 6 years ago

lukasz-gosiewski commented 6 years ago

Context

When using IndexMapReduce in Java client Riak is returning an empty list instead of proper results, despite that everything is working fine in Python and over HTTP.

Expected Behavior

Riak should return list of all objects containing specified index.

Actual Behavior

Riak is returning empty list instead

Steps to Reproduce

  1. Create bucket, name it and insert data into int
  2. Index this data with few indexes matching searched one
  3. Execute below code with few corrections to match your env
  4. Empty list arrives!

Your Environment


MapReduce mapReduce = new IndexMapReduce.Builder()
                .withNamespace(new Namespace(transactionsBucketName))
                .withIndex("addr_out_" + BaseEncoding.base32().encode(address.getBytes()) + "_bin")
                .withRange(BinaryValue.unsafeCreate("0".getBytes()), BinaryValue.unsafeCreate("z".getBytes()))
                .withMapPhase(Function.newNamedJsFunction("Riak.mapValues"))
                .build();

        IndexMapReduce.Response response;

        try {
            response = riakClient.execute(mapReduce);
        } catch (ExecutionException | InterruptedException e) {
            log.error(e);
            throw new DataFetchException(e);
        }

        log.info(response);```