added cursor to get all search results and minor index building bug fix