@@ -114,6 +114,14 @@ const VECTOR_PROBE_BUDGET_MS = 600
114114 * comparable cache pressure: the access predicate, evaluated once per document.
115115 */
116116const VECTOR_PROBE_MICROSECONDS_PER_DOCUMENT = 6
117+ /**
118+ * What a filter-first probe may spend: it reads the filtered documents off their own index and
119+ * tests each one's access, bounded by the same document limit, and measures around 2 µs per
120+ * document to enumerate plus the access test — a window at the limit fits with room. Its result
121+ * is ranked exactly, at a cost that is predictable where a walk through a mostly-excluded
122+ * neighbourhood is not.
123+ */
124+ const FILTERED_PROBE_BUDGET_MS = 1500
117125/**
118126 * Documents the probe enumerates before it concludes the permitted set is too large to rank
119127 * exactly. Derived so that reaching it is what spends the probe's budget, rather than a separate
@@ -1001,7 +1009,9 @@ async function probeVisibleDocuments(
10011009 stage : 'vector.probe' | 'permitted_documents' ,
10021010 shape : 'reach-first' | 'direct' = 'reach-first'
10031011) : Promise < ProbeOutcome > {
1004- const probeBudget = budget ?. capped ( VECTOR_PROBE_BUDGET_MS )
1012+ const probeBudget = budget ?. capped (
1013+ shape === 'direct' ? FILTERED_PROBE_BUDGET_MS : VECTOR_PROBE_BUDGET_MS
1014+ )
10051015 try {
10061016 const probed = await runSearchQuery ( probeBudget , stage , ( executor ) =>
10071017 executor . execute < PermittedDocument & { saturated : boolean } > (
0 commit comments