Skip to main content

apply_scope_gate

Function apply_scope_gate 

Source
pub fn apply_scope_gate(query: &str, hits: &mut Vec<Hit>)
Expand description

Scope gate for a qualified query (Foo::Bar#baz). When the user names an enclosing scope and at least one result actually sits in it, drop the rest — a baz outside Foo::Bar is noise next to the one inside it, the same way the relevance gate drops fuzzy near-matches beside an exact hit. When nothing matches the scope, the list is left untouched: the scope was a hint, and the definition may simply live somewhere we didn’t expect, so a baz elsewhere still surfaces rather than returning empty.

An in-scope result is one the scorer gave the parent feature — i.e. its recorded parent ends with the qualifier’s scope chain.