Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(core): fix table text content search (#10488)

EYHN4daa763c9592
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 0ffc4014bd..86b1e573c2 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<IndexerJobPayload> =
new IndexedDBJobQueue<IndexerJobPayload>(
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 f4a0b71a32..01a8d74876 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<string>(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,
});