Spotlight rank
Score every chunk in a compiled document against a probe.
import { Create, spotlight } from "@koda.oss/glyph";
const doc = spotlight.New( "Goodbye moon under quiet stars. Unrelated pasta recipe.",);
const results = doc.Rank(Create("Goodbye moon under quiet stars").glyph);
for (const hit of results) { console.log(hit.score, hit.text);}Result shape
Section titled “Result shape”interface GlyphSpotlightResult { text: string; glyph: Glyph; length: number; score: number; comparison: GlyphComparisonResult; matched?: string | number; // when probe is a group}Results are sorted by score descending. Every compiled chunk appears once (no threshold filter).
Group probes
Section titled “Group probes”When the probe is a GlyphGroup, pairwise scores are aggregated with GroupResultAggregatorSum by default (sum of similarities). Pass aggregate to override (for example GroupResultAggregatorMax).
textOutput
Section titled “textOutput”const texts = doc.Rank(probe, { textOutput: true });// string[] — same order as full results