fix(server): missing embedding search (#13401)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Enhanced search functionality to include results from additional
"blob" data sources, providing more comprehensive search results.

* **Bug Fixes**
* Improved messaging to ensure "No results found" is only shown when no
relevant results exist across all data sources.

* **Tests**
* Updated test cases to reflect new keyword contexts, improving
validation accuracy for search-related features.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
DarkSky
2025-08-04 16:19:59 +08:00
committed by GitHub
parent 76eedf3b76
commit c31504baaf
3 changed files with 33 additions and 8 deletions
@@ -42,12 +42,14 @@ export const buildDocSearchGetter = (
chunks.filter(c => 'docId' in c),
'Doc.Read'
);
const blobChunks = chunks.filter(c => 'blobId' in c);
const fileChunks = chunks.filter(c => 'fileId' in c);
if (contextChunks.length) {
fileChunks.push(...contextChunks);
}
if (!docChunks.length && !fileChunks.length)
if (!blobChunks.length && !docChunks.length && !fileChunks.length) {
return `No results found for "${query}".`;
}
const docIds = docChunks.map(c => ({
// oxlint-disable-next-line no-non-null-assertion
@@ -80,6 +82,7 @@ export const buildDocSearchGetter = (
return [
...fileChunks.map(clearEmbeddingChunk),
...blobChunks.map(clearEmbeddingChunk),
...docChunks.map(c => ({
...c,
...docMetas.get(c.docId),