search for string in db is working with callback function