diff --git a/server/core/src/indexer/fulltextPush.ts b/server/core/src/indexer/fulltextPush.ts index f5ffc3d5dd..b018f49f63 100644 --- a/server/core/src/indexer/fulltextPush.ts +++ b/server/core/src/indexer/fulltextPush.ts @@ -303,4 +303,9 @@ function updateDoc2Elastic ( } } } + + const spaceKey = docKey('space', { _class: core.class.Doc }) + if (doc[spaceKey] !== undefined) { + doc.space = doc[spaceKey] + } } diff --git a/server/core/src/indexer/indexer.ts b/server/core/src/indexer/indexer.ts index b931d30f91..b8c0cf4aaf 100644 --- a/server/core/src/indexer/indexer.ts +++ b/server/core/src/indexer/indexer.ts @@ -31,7 +31,8 @@ import core, { _getOperator, setObjectValue, toFindResult, - versionToString + versionToString, + docKey } from '@hcengineering/core' import { DbAdapter } from '../adapter' import { RateLimitter } from '../limitter' @@ -145,7 +146,7 @@ export class FullTextIndexPipeline implements FullTextPipeline { } } - updateDoc(doc: T, tx: DocumentUpdate, updateDate: boolean): T { + updateDoc (doc: DocIndexState, tx: DocumentUpdate, updateDate: boolean): DocIndexState { for (const key in tx) { if (key.startsWith('$')) { const operator = _getOperator(key) @@ -154,6 +155,12 @@ export class FullTextIndexPipeline implements FullTextPipeline { setObjectValue(key, doc, (tx as any)[key]) } } + + const spaceKey = docKey('space', { _class: core.class.Doc }) + if (doc.attributes !== undefined && doc.attributes[spaceKey] !== undefined) { + doc.space = doc.attributes[spaceKey] + } + if (updateDate) { doc.modifiedBy = core.account.System doc.modifiedOn = Date.now()