Map-reduce algorithms for search