[misc] add a helper for normalizing queries and detecting ObjectIds GitOrigin-RevId: 4f0ac53219ab5853b5499447334724c6c39c6303