Add support for opening queries at results/<query_id>

This resolves #323.