added pagination support to the search API.