From d2b0ee40a8b8a59aaf623c4ae1dc81ec56e2e6e2 Mon Sep 17 00:00:00 2001 From: EYHN Date: Fri, 9 Aug 2024 08:24:44 +0000 Subject: [PATCH] fix(core): disable blocksuite indexer (#7813) --- .../infra/src/modules/workspace/entities/workspace.ts | 2 ++ .../src/modules/workspace/testing/testing-provider.ts | 4 ++++ .../src/blocksuite/presets/ai/messages/slides-renderer.ts | 7 ++++++- .../core/src/blocksuite/presets/ai/utils/markdown-utils.ts | 6 +++++- .../core/src/components/affine/page-history-modal/data.ts | 2 ++ .../core/src/modules/workspace-engine/impls/cloud.ts | 2 ++ .../core/src/modules/workspace-engine/impls/local.ts | 2 ++ 7 files changed, 23 insertions(+), 2 deletions(-) diff --git a/packages/common/infra/src/modules/workspace/entities/workspace.ts b/packages/common/infra/src/modules/workspace/entities/workspace.ts index 59f5dba71a..2695d3ca3f 100644 --- a/packages/common/infra/src/modules/workspace/entities/workspace.ts +++ b/packages/common/infra/src/modules/workspace/entities/workspace.ts @@ -34,6 +34,8 @@ export class Workspace extends Entity { }, idGenerator: () => nanoid(), schema: globalBlockSuiteSchema, + disableBacklinkIndex: true, + disableSearchIndex: true, }); } return this._docCollection; diff --git a/packages/common/infra/src/modules/workspace/testing/testing-provider.ts b/packages/common/infra/src/modules/workspace/testing/testing-provider.ts index 1f525d549d..2fcb6b0607 100644 --- a/packages/common/infra/src/modules/workspace/testing/testing-provider.ts +++ b/packages/common/infra/src/modules/workspace/testing/testing-provider.ts @@ -61,6 +61,8 @@ export class TestingWorkspaceLocalProvider blobSources: { main: blobStorage, }, + disableBacklinkIndex: true, + disableSearchIndex: true, }); // apply initial state @@ -95,6 +97,8 @@ export class TestingWorkspaceLocalProvider const bs = new DocCollection({ id, schema: globalBlockSuiteSchema, + disableBacklinkIndex: true, + disableSearchIndex: true, }); applyUpdate(bs.doc, data); diff --git a/packages/frontend/core/src/blocksuite/presets/ai/messages/slides-renderer.ts b/packages/frontend/core/src/blocksuite/presets/ai/messages/slides-renderer.ts index d30edf51e4..a47e2e859b 100644 --- a/packages/frontend/core/src/blocksuite/presets/ai/messages/slides-renderer.ts +++ b/packages/frontend/core/src/blocksuite/presets/ai/messages/slides-renderer.ts @@ -213,7 +213,12 @@ export class AISlidesRenderer extends WithDisposable(LitElement) { super.connectedCallback(); const schema = new Schema().register(AffineSchemas); - const collection = new DocCollection({ schema, id: 'SLIDES_PREVIEW' }); + const collection = new DocCollection({ + schema, + id: 'SLIDES_PREVIEW', + disableBacklinkIndex: true, + disableSearchIndex: true, + }); collection.meta.initialize(); collection.start(); const doc = collection.createDoc(); diff --git a/packages/frontend/core/src/blocksuite/presets/ai/utils/markdown-utils.ts b/packages/frontend/core/src/blocksuite/presets/ai/utils/markdown-utils.ts index 5189f5cea4..d399e6a565 100644 --- a/packages/frontend/core/src/blocksuite/presets/ai/utils/markdown-utils.ts +++ b/packages/frontend/core/src/blocksuite/presets/ai/utils/markdown-utils.ts @@ -187,7 +187,11 @@ export async function replaceFromMarkdown( export async function markDownToDoc(host: EditorHost, answer: string) { const schema = host.std.doc.collection.schema; // Should not create a new doc in the original collection - const collection = new DocCollection({ schema }); + const collection = new DocCollection({ + schema, + disableBacklinkIndex: true, + disableSearchIndex: true, + }); collection.meta.initialize(); const job = new Job({ collection, diff --git a/packages/frontend/core/src/components/affine/page-history-modal/data.ts b/packages/frontend/core/src/components/affine/page-history-modal/data.ts index 2df0f71c41..4912eb6c62 100644 --- a/packages/frontend/core/src/components/affine/page-history-modal/data.ts +++ b/packages/frontend/core/src/components/affine/page-history-modal/data.ts @@ -109,6 +109,8 @@ const getOrCreateShellWorkspace = (workspaceId: string) => { main: blobStorage, }, schema: globalBlockSuiteSchema, + disableBacklinkIndex: true, + disableSearchIndex: true, }); docCollectionMap.set(workspaceId, docCollection); docCollection.doc.emit('sync', [true, docCollection.doc]); diff --git a/packages/frontend/core/src/modules/workspace-engine/impls/cloud.ts b/packages/frontend/core/src/modules/workspace-engine/impls/cloud.ts index 18249e44f3..695cd630d5 100644 --- a/packages/frontend/core/src/modules/workspace-engine/impls/cloud.ts +++ b/packages/frontend/core/src/modules/workspace-engine/impls/cloud.ts @@ -100,6 +100,8 @@ export class CloudWorkspaceFlavourProviderService blobSources: { main: blobStorage, }, + disableBacklinkIndex: true, + disableSearchIndex: true, }); // apply initial state diff --git a/packages/frontend/core/src/modules/workspace-engine/impls/local.ts b/packages/frontend/core/src/modules/workspace-engine/impls/local.ts index 5511e31c1f..d19a5c76a2 100644 --- a/packages/frontend/core/src/modules/workspace-engine/impls/local.ts +++ b/packages/frontend/core/src/modules/workspace-engine/impls/local.ts @@ -72,6 +72,8 @@ export class LocalWorkspaceFlavourProvider idGenerator: () => nanoid(), schema: globalBlockSuiteSchema, blobSources: { main: blobStorage }, + disableBacklinkIndex: true, + disableSearchIndex: true, }); // apply initial state