From 4daa763c9592f6cecc8af318a7f2219bd500843b Mon Sep 17 00:00:00 2001 From: EYHN Date: Wed, 5 Mar 2025 04:06:43 +0000 Subject: [PATCH] fix(core): fix table text content search (#10488) --- .../docs-search/entities/docs-indexer.ts | 2 +- .../modules/docs-search/worker/in-worker.ts | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/frontend/core/src/modules/docs-search/entities/docs-indexer.ts b/packages/frontend/core/src/modules/docs-search/entities/docs-indexer.ts index 0ffc4014b..86b1e573c 100644 --- a/packages/frontend/core/src/modules/docs-search/entities/docs-indexer.ts +++ b/packages/frontend/core/src/modules/docs-search/entities/docs-indexer.ts @@ -32,7 +32,7 @@ export class DocsIndexer extends Entity { /** * increase this number to re-index all docs */ - static INDEXER_VERSION = 18; + static INDEXER_VERSION = 19; private readonly jobQueue: JobQueue = new IndexedDBJobQueue( diff --git a/packages/frontend/core/src/modules/docs-search/worker/in-worker.ts b/packages/frontend/core/src/modules/docs-search/worker/in-worker.ts index f4a0b71a3..01a8d7487 100644 --- a/packages/frontend/core/src/modules/docs-search/worker/in-worker.ts +++ b/packages/frontend/core/src/modules/docs-search/worker/in-worker.ts @@ -821,10 +821,20 @@ async function crawlingDocData({ ...commonBlockProps, content: block.get('prop:latex')?.toString() ?? '', }); - } else if ( - bookmarkFlavours.has(flavour) || - flavour === TableModelFlavour - ) { + } else if (flavour === TableModelFlavour) { + const contents = Array.from(block.keys()) + .map(key => { + if (key.startsWith('prop:cells.') && key.endsWith('.text')) { + return block.get(key)?.toString() ?? ''; + } + return ''; + }) + .filter(Boolean); + blockDocuments.push({ + ...commonBlockProps, + content: contents, + }); + } else if (bookmarkFlavours.has(flavour)) { blockDocuments.push({ ...commonBlockProps, });