Migrated p/c queries from id cache to field data.

PR for #4930