A rewrite to include more information in the queries. Including
device information to partition data, and location to limit the search
space.