add range query support

details in commit message