Add scopedQuery method as suggested in #272.