updated query engine to support polymorphic queries used in security impl. MID-1881