Allow querying on referenced class and id