Querying the view with map/reduce functions?


#1

Hi there!

I am using CBL 1.4 on Adroid.
I have a view with map and reduce functions and I want to query this view only with map function so according to docs I use setMapOnly(true) but result always empty. If I split this view into two views one with map for normal quering and other with map/reduce for “grouping” docs then everything works fine as expected.

Question: what does setMapOnly and is it possible to query map/reduce view only with map function?
Thanks!

ps The view is very simple: key and value are string values.


#2

Are you changing map functions without altering the version number? If so the results will become invalid. setMapOnly should do exactly what it says, and skip the reduce portion of a map/reduce view so I’m not sure what is happening on your side.


#3

No, I do not change map/reduce functions or version number. I get the view from db only once while initializing db layer.
If I query all docs from db I see those docs I want to retrive (they all have fields used in map function). But if I create query and set “map only” flag then I get empty collection.


#4

Sorry, my bad.
Some documents had field with null value which was emitted as key in this view so they were not indexed.

Thanks!