Multi-threading for index generation and query.