Further improve memory filter to support CouchDB-style map/reduce, based loosely on the old memory-filters branch, and on review of the CouchDB engine code