basho / riak-java-client

The Riak client for Java.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IndexMapReduce returning empty list

lukasz-gosiewski opened this issue · comments

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

  • [ 2.1.1] Riak Java Client version
  • [ 1.8] Java version
  • [ArchLinux on client side, Ubuntu on server side ] Operating System / Distribution & Version
  • [ RiakClient.execute()] What methods were being executed during the error
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);```