mirror of
https://github.com/nasa/openmct.git
synced 2025-02-20 17:33:23 +00:00
[Search] Generic indexes once
Changed the generic search provider to index the file tree only once when it is initially called. This assumes that the contents of the file tree will not change significantly within the course of a use session (and some changes may be caught by other search providers).
This commit is contained in:
parent
ce433a01b2
commit
639cf1cf59
@ -181,14 +181,30 @@ define(
|
||||
maxResults = DEFAULT_MAX_RESULTS;
|
||||
}
|
||||
|
||||
/*
|
||||
// Get items list
|
||||
return getItems(timeout).then(function () {
|
||||
// Then get the worker to search through it
|
||||
workerSearch(input, maxResults, timestamp);
|
||||
return; // There's nothing we need to return here
|
||||
});
|
||||
*/
|
||||
|
||||
// Instead, assume that the items have already been indexed, and
|
||||
// just send the query to the worker.
|
||||
|
||||
workerSearch(input, maxResults, timestamp);
|
||||
return;
|
||||
}
|
||||
|
||||
// Index the tree's contents once at the beginning
|
||||
// TODO: Is this a good assumption that the tree's contents will not
|
||||
// change often enough?
|
||||
// TODO: This makes the timeout parameter that queryGeneric takes
|
||||
// useless. See if timing out worker is an idea that works.
|
||||
getItems();
|
||||
|
||||
|
||||
return {
|
||||
/**
|
||||
* Searches through the filetree for domain objects which match
|
||||
|
@ -34,7 +34,6 @@
|
||||
// Helper function for index()
|
||||
function conainsItem(id) {
|
||||
var i;
|
||||
|
||||
for (i = 0; i < indexedItems.length; i += 1) {
|
||||
if (indexedItems[i].id === id) {
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user