1. A method for providing a virtual environment spanning a desktop and a cloud, the method comprising: receiving a query template over a data set that resides in the cloud; optimizing the query template to segment the query template into an offline phase and an online phase; executing the offline phase on the cloud to build one or more indexes; and sending the one or more indexes to the desktop.