Implement set query