I believe that you have to write your own query mechanism (iterating through the elements and testing each one). I think you'll find it to be quite fast (although I feel like certain things take an inordinate amount of time - such as testing for specific categories).