mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-25 19:58:30 +03:00
fix overwriting space in elastic doc (#5959)
This commit is contained in:
parent
51028108c7
commit
8d6b583628
@ -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>
|
||||
|
@ -44,7 +44,7 @@ describe('Elastic Adapter', () => {
|
||||
_class: ['class1' as Ref<Class<Doc>>],
|
||||
modifiedBy: 'andrey' as Ref<Account>,
|
||||
modifiedOn: 0,
|
||||
space: 'space1' as Ref<Space>,
|
||||
space: ['space1' as Ref<Space>],
|
||||
content0: 'hey there!'
|
||||
}
|
||||
await adapter.index(doc)
|
||||
|
Loading…
Reference in New Issue
Block a user