Skip to content

Commit 63eb8e0

Browse files
committed
fix(search): include empty overlay_hits/baseline_hits on grouped NO_MATCH
1 parent 20b5e41 commit 63eb8e0

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

workers/src/orchestrate.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,13 +1372,18 @@ async function runSearch(
13721372
: undefined;
13731373

13741374
if (hits.length === 0) {
1375+
const noMatchResult: Record<string, unknown> = {
1376+
status: "NO_MATCH",
1377+
docs_considered: index.entries.length,
1378+
hits: [],
1379+
};
1380+
if (resolvedGrouping === "grouped") {
1381+
noMatchResult.overlay_hits = [];
1382+
noMatchResult.baseline_hits = [];
1383+
}
13751384
return {
13761385
action: "search",
1377-
result: {
1378-
status: "NO_MATCH",
1379-
docs_considered: index.entries.length,
1380-
hits: [],
1381-
},
1386+
result: noMatchResult,
13821387
state: updatedState,
13831388
assistant_text: `Searched ${index.stats.total} documents but found no matches for "${input}". Try rephrasing or ask with action "catalog" to see available documentation.`,
13841389
debug: {

0 commit comments

Comments
 (0)