Skip to main content

index_admissible_for_skip_if_absent

Function index_admissible_for_skip_if_absent 

Source
pub fn index_admissible_for_skip_if_absent(
    index: &Index,
    bindings: &[SkipIfAbsentBinding<'_>],
) -> bool
Expand description

Whether a query constraining fields as bindings may be served by index given its skipIfAbsent participation.

A skipIfAbsent index holds only the documents that carry every property of its skip set — it is a SPARSE projection of the document type. An index picker must not route a query to it that never binds those properties: the generic matcher does not require contiguously bound prefixes (an unused property merely counts toward the difference score), and the aggregate pickers match a prefix that may stop above a deep skip property. Without this gate such a query would silently omit every document the index skipped — a result a complete index would have included. So every skip property must be bound:

  • On an indexOnly type (whose indexes carry a terminal) any binding counts, the order-by included: a missing value has no index representation anywhere on such a type, so binding the property is asking “among documents carrying it”, which is exactly what the index holds.
  • On a stored type a missing value is indexed under the empty key by every index that does not skip it, so a skip property counts as bound only by a constraint that no missing value can meet (SkipIfAbsentBinding::excludes_missing).

For every index a contract could declare before skip properties could sit below the first position, the skip set is the first property, which the contiguous and exact matchers already bind; the gate then changes no choice.