Skip to main content

group_predicates

Function group_predicates 

Source
pub fn group_predicates(
    terms: &[EncodedTerm],
    hits: &[DomainScanHit],
) -> Vec<Vec<EncodedTerm>>
Expand description

Group (object, predicate) domain-scan hits into one predicate list per walked object, aligned with terms.

The domain scan emits hits in constraint order and terms is the sorted constraint list, so a single forward merge is linear in both inputs. The merge asserts that ordering instead of assuming it: a hit whose constraint is behind the cursor means the caller’s contract broke, and silently ignoring the hit (or attaching it to a later object) would index a predicate under the wrong literal — a wrong answer, not a slow one.