use thread to search for query variables