Android and LiveQuery - Advice/best-practise for filtering

Sorry, you can’t do that. The map function runs while the view is being indexed, before the query. And multiple queries will use the same index. That’s why the map function has to be a pure function with no external state and no side effects.

So when you design the map function you have to think of handling all queries, not a specific query. In your case you want to put all three keys into the index so they can be searched for. The way to implement this is to make the map function emit all three of the keys —

emit(doc.key1, ...);
emit(doc.key2, ...);
emit(doc.key3, ...);

Then set the query’s keys property to an array [localkey1, localkey2, localkey3]. That will find all docs with any of those local key strings. You may get duplicate rows in the result if one of the documents contains more than one of the local keys; you’ll have to filter those out yourself.