From 9013ca0037fca083dc1d3073278ecc74f2de5152 Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Sat, 15 Mar 2025 20:49:54 +0700 Subject: [PATCH] QFix reindex (#8236) --- dev/prod/public/config.json | 24 ++++++++++++------------ server/indexer/src/indexer/indexer.ts | 7 ++----- server/indexer/src/indexer/types.ts | 4 ++++ 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/dev/prod/public/config.json b/dev/prod/public/config.json index 8b0a25e6dd..e974a0ff32 100644 --- a/dev/prod/public/config.json +++ b/dev/prod/public/config.json @@ -1,25 +1,25 @@ { "ACCOUNTS_URL": "/account", - "COLLABORATOR_URL": "ws://localhost:3078", + "COLLABORATOR_URL": "ws://huly.local:3078", "UPLOAD_URL": "/files", - "TELEGRAM_URL": "http://localhost:8086", - "GMAIL_URL": "http://localhost:8088", + "TELEGRAM_URL": "http://huly.local:8086", + "GMAIL_URL": "http://huly.huly.local:8088", "CALENDAR_URL": "http://localhost:8095", "REKONI_URL": "/rekoni", "GITHUB_APP": "uberflow-dev", "GITHUB_CLIENTID": "Iv1.43f9cac43bd68617", - "GITHUB_URL": "http://localhost:3500", + "GITHUB_URL": "http://huly.local:3500", "LAST_NAME_FIRST": "true", - "PRINT_URL": "http://localhost:4005", - "SIGN_URL": "http://localhost:4006", - "ANALYTICS_COLLECTOR_URL": "http://localhost:4017", - "AI_URL": "http://localhost:4010", + "PRINT_URL": "http://huly.local:4005", + "SIGN_URL": "http://huly.local:4006", + "ANALYTICS_COLLECTOR_URL": "http://huly.local:4017", + "AI_URL": "http://huly.local:4010", "BRANDING_URL": "/branding.json", "VERSION": null, "MODEL_VERSION": null, - "STATS_URL": "http://localhost:4900", + "STATS_URL": "http://huly.local:4900", "PASSWORD_STRICTNESS": "none", - "STREAM_URL": "http://localhost:1080/recording", - "PUBLIC_SCHEDULE_URL": "http://localhost:8060", - "EXPORT_URL": "http://localhost:4009/export" + "STREAM_URL": "http://huly.local:1080/recording", + "PUBLIC_SCHEDULE_URL": "http://huly.local:8060", + "EXPORT_URL": "http://huly.local:4009/export" } diff --git a/server/indexer/src/indexer/indexer.ts b/server/indexer/src/indexer/indexer.ts index 944dcfbf27..c3254c9a36 100644 --- a/server/indexer/src/indexer/indexer.ts +++ b/server/indexer/src/indexer/indexer.ts @@ -64,7 +64,7 @@ import type { import { RateLimiter, SessionDataImpl } from '@hcengineering/server-core' import { jsonToText, markupToJSON, markupToText } from '@hcengineering/text' import { findSearchPresenter, updateDocWithPresenter } from '../mapper' -import { type FullTextPipeline } from './types' +import { docStructure, fullReindex, indexes, type FullTextPipeline } from './types' import { createIndexedDoc, createStateDoc, getContent } from './utils' export * from './types' @@ -205,7 +205,6 @@ export class FullTextIndexPipeline implements FullTextPipeline { }) ) - const indexes = 'verify-indexes-v2' if (migrations.find((it) => it.state === indexes) === undefined) { ctx.warn('Rebuild DB index', { workspace: this.workspace.uuid }) // Clean all existing docs, they will be re-created on verify stage @@ -215,7 +214,6 @@ export class FullTextIndexPipeline implements FullTextPipeline { ctx.warn('Rebuild DB index complete', { workspace: this.workspace.uuid }) } - const fullReindex = 'full-text-indexer-v5' if (migrations.find((it) => it.state === fullReindex) === undefined) { ctx.warn('rebuilding index to v5', { workspace: this.workspace.uuid }) // Clean all existing docs, they will be re-created on verify stage @@ -229,7 +227,6 @@ export class FullTextIndexPipeline implements FullTextPipeline { await this.addMigration(ctx, fullReindex) } - const docStructure = 'full-text-structure-v6' if (migrations.find((it) => it.state === docStructure) === undefined) { ctx.warn('verify document structure', { version: docStructure, workspace: this.workspace.uuid }) @@ -293,7 +290,7 @@ export class FullTextIndexPipeline implements FullTextPipeline { const migrations = await this.storage.findAll(ctx, core.class.MigrationState, { plugin: coreId, state: { - $in: ['verify-indexes-v2', 'full-text-indexer-v5', 'full-text-structure-v4'] + $in: [indexes, fullReindex, docStructure] } }) diff --git a/server/indexer/src/indexer/types.ts b/server/indexer/src/indexer/types.ts index 7d2d199884..cae2aefe02 100644 --- a/server/indexer/src/indexer/types.ts +++ b/server/indexer/src/indexer/types.ts @@ -39,3 +39,7 @@ export interface FullTextPipeline { * @public */ export type DocUpdateHandler = (doc: DocIndexState, update: DocumentUpdate) => Promise + +export const indexes = 'verify-indexes-v2' +export const fullReindex = 'full-text-indexer-v5' +export const docStructure = 'full-text-structure-v6'