Query not working properly with keys

  1. I am using couch base lite 1.0.4 for android when i running follwoing Query i am getting count is 0 but data is presenet in CBl.
com.couchbase.lite.View view = database.getView("getRelated");
if (view.getMap() == null){
    Mapper mapper = new Mapper() {
        @Override
        public void map(Map<String, Object> document, Emitter emitter) {
            java.util.List<Object> keys = new ArrayList<Object>();
            keys.add(document.get("relation"));
            keys.add(document.get("summery"));
            emitter.emit(keys, document.get("_id"));
        }
    };
    view.setMap(mapper, "1");
}
Query query = view.createQuery();
java.util.List<Object> keys = new ArrayList<Object>();
keys.add("text");
keys.add("ok");
query.setKeys(keys);
try {
    QueryEnumerator enumerator =  query.run();
    Log.i(Application.TAG,enumerator.getCount()+"");
} catch (CouchbaseLiteException e) {
    e.printStackTrace();
}

Hi @psrinivasgoud,

It should return number of rows. Couchbase Capella for Mobile Developers

Give us few days to reproduce and investigate this issue.

I filed the issue on github repo’s issue tracker.
https://github.com/couchbase/couchbase-lite-java-core/issues/637

Thanks!
Hideki

@hideki Thanks for the reply its working according to https://github.com/couchbase/couchbase-lite-java-core/issues/637 answer given by sergio91pt .I request couchbase people to improve documentation with more examples specially with composite key which i dint find here Couchbase Capella for Mobile Developers there is no example for query.setKeys() method thanks.

Hi @psrinivasgoud,

I am glad to hear you could solve the problem.

Following is link to unit test case for query with compound keys. It might help you.
https://github.com/couchbase/couchbase-lite-android/blob/master/src/androidTest/java/com/couchbase/lite/ViewsTest.java#L525-L619

Have a nice weekend!