fix overwriting space in elastic doc (#5959)

This commit is contained in:
Vyacheslav Tumanov
2024-07-01 20:30:48 +07:00
committed by GitHub
parent 51028108c7
commit 8d6b583628
4 changed files with 7 additions and 5 deletions
+4 -2
View File
@@ -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)
}
}
+1 -1
View File
@@ -107,4 +107,4 @@ export const fieldStateId = 'fld-v15'
/**
* @public
*/
export const fullTextPushStageId = 'fts-v16'
export const fullTextPushStageId = 'fts-v17'
+1 -1
View File
@@ -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>