Compare commits

...

2 Commits

Author SHA1 Message Date
Andrew Henry
55228d5110 In-memory indexer 2020-10-01 07:21:03 -07:00
Andrew Henry
2ba1f792c0 Added stubs for search API 2020-09-29 10:42:26 -07:00
2 changed files with 14 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2020, United States Government
* Open MCT, Copyright (c) 2014-2018, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@@ -138,6 +138,10 @@ define([
});
};
ObjectServiceProvider.prototype.search = function (searchOptions) {
return this.inMemoryIndex.search(searchOptions);
};
// Injects new object API as a decorator so that it hijacks all requests.
// Object providers implemented on new API should just work, old API should just work, many things may break.
function LegacyObjectAPIInterceptor(openmct, ROOTS, instantiate, topic, objectService) {

View File

@@ -168,6 +168,15 @@ define([
return provider.get(identifier);
};
ObjectAPI.prototype.search = function (searchOptions) {
return Promise.all(Object.values(this.providers)
.filter(provider => provider.search !== undefined)
.map((provider) => {
return provider.search(searchOptions);
}))
.then(allResults => _.flatten(allResults));
};
ObjectAPI.prototype.delete = function () {
throw new Error('Delete not implemented');
};