android - Query multiple keys in couchbase lite view -


hi new couchbase/couchbase-lite , try query view multiple keys without success. how map function looks:

public void map(map<string, object> doc, emitter emitter) {     if (doc.get("type").equals("my_type") {         list<object> keys = new arraylist<object>();         keys.add(doc.get("key_1"));         keys.add(doc.get("key_2"));         emitter.emit(keys, null);      }    } 

my problem need query view either key_1 or combination of key_1 , key_2

list<object> keys = new arraylist<object>(); keys.add(key_1); if (key_2 != null) keys.add(key_2); query.setkeys(keys); results = query.run() 

however results empty. overlook anything?

two emits doesn't work. if give arraylist in setkeys() method, each key in list match each key in emit. if want match 2 keys, add keys arraylist list. pass setkeys() method. this,

list<object> keys = new arraylist<object>(); list<object> allkeys = new arraylist<object>(); keys.add(key_1); if (key_2 != null) keys.add(key_2); allkeys.add(keys); query.setkeys(allkeys); results = query.run(); 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -