UBER-1178: rework indexing fields (#4261)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
Co-authored-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Vyacheslav Tumanov
2023-12-27 14:29:30 +07:00
committed by GitHub
co-authored by Andrey Sobolev
parent 66368621a0
commit 689e2d4caa
6 changed files with 56 additions and 39 deletions
+1 -10
View File
@@ -132,16 +132,7 @@ export function docUpdKey (name: string, opt?: IndexKeyOptions): string {
*/
export function docKey (name: string, opt?: IndexKeyOptions): string {
const extra = opt?.extra !== undefined && opt?.extra?.length > 0 ? `#${opt.extra?.join('#') ?? ''}` : ''
let key =
(opt?.docId !== undefined ? opt.docId.split('.').join('_') + '|' : '') +
(opt?._class === undefined ? name : `${opt?._class}%${name}${extra}`)
if (opt?.refAttribute !== undefined) {
key = `${opt?.refAttribute}->${key}`
}
if (opt?.refAttribute !== undefined || (opt?.relative !== undefined && opt?.relative)) {
key = '|' + key
}
return key
return opt?._class === undefined ? name : `${opt?._class}%${name}${extra}`
}
/**