Unexpected view behaviour

Hi

I’m getting unexpected behaviour with indexes created by views in design documents.

I noticed that some of my views were not indexing documents I would expect them to. On closer examination I found that minor whitespace changes to the javascript would deterministically effect which documents were emitted. This seems wrong.

I have not got to the bottom of why this is happening. My guess is that if more that one view in a design document emits the same document then only one of them will do so successfully. In other words the views are exclusive in how they index documents. The whitespace changes would be explained if which view wins is based of a sort of a hash of their javascript, is this happening?

This behaviour in Couchbase is different from the behaviour of Walrus or Couchdb. This is either a bug, or if it is expected behaviour it needs to be documented.

It can be hard to manage that views that share a design document don’t interfere with each other if this is happening and maybe every view should have its own design document?

If you need a test I can put something together

P

If case anyone else is having this problem it was a bug in Sync Gateway’s indexing which is now fixed in master.