Adding support for ancestor queries.