Expand the search functions to return either the requested data or just a count of the max data