mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-22 04:26:23 +08:00
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:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user