Skip to content

Commit 886c5f7

Browse files
committed
fix(knowledge): start the scan budget over when the pages are rebuilt
The candidates already seen before a denied source was known are skipped when the pages are rebuilt, but they still counted against the scan budget, so a refill could exhaust it before reaching the readable candidates ranked after the denied source.
1 parent b958c90 commit 886c5f7

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎apps/sim/lib/knowledge/search/queries.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,9 @@ async function selectAuthorizedSearchResults(input: {
743743
for (const row of ranked) results.set(row.id, row)
744744
}
745745
if (refill) {
746+
/** The rebuilt pages are a new stream of candidates, so the scan budget starts over. */
746747
offset = 0
748+
scanned = 0
747749
continue
748750
}
749751
/** A short page is the end of the candidates, whether or not they were reordered. */

0 commit comments

Comments
 (0)