more identifier fixes to search

This commit is contained in:
David Tsay 2022-03-14 16:01:23 -07:00
parent 3b316ed491
commit 526e31d10c

View File

@ -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);