add search function for CouchDB