Description
The problem is that the indexFilters
need to be run against a partial record while the type filter indicates that the index entries do not all correspond to the same record type.
The correct fix may well be to eliminate partial records in favor of being able to run filter expressions against the index entry more directly through some Value
-like meta-data.
It might be possible, though, to refactor FilterVisitor
(and RecordQueryPlannerSubstitutionVisitor
) to build a partial record using one of the index record types (for instance, the one for the type filter) only for the purpose of running the filter, and then immediately do RecordQueryFetchFromPartialRecordPlan
, then the RecordQueryTypeFilterPlan
, then any residualFilters
(which are allowed to use fields specific to that type). This is (kind of) valid because the pre-fetch filters must be on fields only in the index entry and so common to all indexed record types. They might be in the same place (for instance, inside a common included header sub-message) or not, but that's okay if the only need is to evaluate those filters.