Performance improved by caching inv_index.