query find implementation