query service implementation.