mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-07 02:07:43 +02:00
fix overwriting space in elastic doc (#5959)
This commit is contained in:
@@ -239,7 +239,7 @@ export function createElasticDoc (upd: DocIndexState): IndexedDoc {
|
||||
_class: [upd.objectClass, ...(upd.mixins ?? [])],
|
||||
modifiedBy: upd.modifiedBy,
|
||||
modifiedOn: upd.modifiedOn,
|
||||
space: upd.space,
|
||||
space: [upd.space],
|
||||
attachedTo: upd.attachedTo,
|
||||
attachedToClass: upd.attachedToClass
|
||||
}
|
||||
@@ -321,6 +321,8 @@ function updateDoc2Elastic (
|
||||
|
||||
const spaceKey = docKey('space', { _class: core.class.Doc })
|
||||
if (doc[spaceKey] !== undefined) {
|
||||
doc.space = doc[spaceKey]
|
||||
const existsingSpace = Array.isArray(doc.space) ? doc.space : [doc.space]
|
||||
const newSpaces = Array.isArray(doc[spaceKey]) ? doc[spaceKey] : [doc[spaceKey]]
|
||||
doc.space = [...existsingSpace, ...newSpaces].filter((it, idx, arr) => arr.indexOf(it) === idx)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,4 +107,4 @@ export const fieldStateId = 'fld-v15'
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const fullTextPushStageId = 'fts-v16'
|
||||
export const fullTextPushStageId = 'fts-v17'
|
||||
|
||||
@@ -213,7 +213,7 @@ export interface EmbeddingSearchOption {
|
||||
export interface IndexedDoc {
|
||||
id: Ref<Doc>
|
||||
_class: Ref<Class<Doc>>[]
|
||||
space: Ref<Space>
|
||||
space: Ref<Space>[]
|
||||
modifiedOn: Timestamp
|
||||
modifiedBy: Ref<Account>
|
||||
attachedTo?: Ref<Doc>
|
||||
|
||||
Reference in New Issue
Block a user