From 526e31d10c98b518e9bd06f736877899daaccea2 Mon Sep 17 00:00:00 2001 From: David Tsay Date: Mon, 14 Mar 2022 16:01:23 -0700 Subject: [PATCH] more identifier fixes to search --- src/api/objects/InMemorySearchProvider.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/api/objects/InMemorySearchProvider.js b/src/api/objects/InMemorySearchProvider.js index dff7bbfdb2..eb7d06b75b 100644 --- a/src/api/objects/InMemorySearchProvider.js +++ b/src/api/objects/InMemorySearchProvider.js @@ -223,6 +223,7 @@ class InMemorySearchProvider { onMutationOfIndexedObject(domainObject) { const provider = this; + provider.index(domainObject); } @@ -236,14 +237,13 @@ class InMemorySearchProvider { */ async index(domainObject) { const provider = this; - const identifier = domainObject.identifier; - const keyString = this.openmct.objects.makeKeyString(identifier); + const keyString = this.openmct.objects.makeKeyString(domainObject.identifier); if (!this.indexedIds[keyString]) { this.indexedIds[keyString] = this.openmct.objects.observe(domainObject, '*', this.onMutationOfIndexedObject); } - if ((identifier.key !== 'ROOT')) { + if ((keyString !== 'ROOT')) { if (this.worker) { this.worker.port.postMessage({ request: 'index', @@ -258,9 +258,9 @@ class InMemorySearchProvider { const composition = this.openmct.composition.get(domainObject); if (composition !== undefined) { - const childIdentifiers = await composition.load(domainObject); - childIdentifiers.forEach(function (childIdentifier) { - provider.scheduleForIndexing(childIdentifier); + const children = await composition.load(domainObject); + children.forEach(function (child) { + provider.scheduleForIndexing(child.identifier); }); } } @@ -277,9 +277,9 @@ class InMemorySearchProvider { const provider = this; this.pendingRequests += 1; - const identifier = await this.openmct.objects.parseKeyString(keyString); - const domainObject = await this.openmct.objects.get(identifier); + const domainObject = await this.openmct.objects.get(keyString); delete provider.pendingIndex[keyString]; + try { if (domainObject) { await provider.index(domainObject);