mirror of
https://github.com/nasa/openmct.git
synced 2025-05-30 06:04:20 +00:00
[Search] Comments
Removed extra commented out code.
This commit is contained in:
parent
f0f396f656
commit
41c38f202d
@ -85,23 +85,6 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return filteredResults;
|
return filteredResults;
|
||||||
/*
|
|
||||||
var ids = [];
|
|
||||||
|
|
||||||
for (var i = 0; i < results.length; i += 1) {
|
|
||||||
if (ids.indexOf(results[i].id) !== -1) {
|
|
||||||
// If this result's ID is already there, remove the object
|
|
||||||
results.splice(i, 1);
|
|
||||||
// Reduce loop index because we shortened the array
|
|
||||||
i -= 1;
|
|
||||||
} else {
|
|
||||||
// Otherwise add the ID to the list of the ones we have seen
|
|
||||||
ids.push(results[i].id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return results;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Order the objects from highest to lowest score in the array
|
// Order the objects from highest to lowest score in the array
|
||||||
@ -117,30 +100,9 @@ define(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
|
||||||
for (var i = 0; i < results.length; i++) {
|
|
||||||
console.log('score', results[i].score, 'for', results[i].object.getModel().name);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// 'Loop' over the promises using recursion so that the promises are fufilled by the
|
|
||||||
// time that we are done
|
|
||||||
function getPromisedResults(resultsPromises, promiseIndex, finalResults) {
|
|
||||||
if (promiseIndex >= resultsPromises.length) {
|
|
||||||
return finalResults;
|
|
||||||
} else {
|
|
||||||
return resultsPromises[promiseIndex].then(function (results) {
|
|
||||||
finalResults = finalResults.concat(results);
|
|
||||||
return getPromisedResults(resultsPromises, promiseIndex + 1, finalResults);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
function updateResults() {
|
function updateResults() {
|
||||||
var newerResults = [];
|
var newerResults = [];
|
||||||
|
|
||||||
@ -168,8 +130,7 @@ define(
|
|||||||
date = new Date(),
|
date = new Date(),
|
||||||
timestamp = date.getTime();
|
timestamp = date.getTime();
|
||||||
|
|
||||||
// Get result list promises
|
// Send the query to all the providers
|
||||||
// TODO: This is now 'Send the query to all the providers'
|
|
||||||
for (var i = 0; i < providers.length; i += 1) {
|
for (var i = 0; i < providers.length; i += 1) {
|
||||||
promises.push(
|
promises.push(
|
||||||
providers[i].query(
|
providers[i].query(
|
||||||
@ -181,24 +142,10 @@ define(
|
|||||||
// And then we might also want to check to see if the timestamp
|
// And then we might also want to check to see if the timestamp
|
||||||
// is correct.
|
// is correct.
|
||||||
|
|
||||||
|
// Update the merged results list
|
||||||
updateResults();
|
updateResults();
|
||||||
|
|
||||||
/*
|
|
||||||
// Wait for the promises to fufill
|
|
||||||
return getPromisedResults(promises, 0, []).then(function (c) {
|
|
||||||
// Get rid of the repeated objects and put in correct order
|
|
||||||
c = filterRepeats(c);
|
|
||||||
c = orderByScore(c);
|
|
||||||
latestMergedResults = c;
|
|
||||||
return c;
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: getLatestResults(start, stop) so you can choose which indicies to start and stop
|
|
||||||
// at, which will allow for 'load more' option
|
|
||||||
// may also need to include timestamp stuff in there
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sendQuery: queryAll,
|
sendQuery: queryAll,
|
||||||
getLatestResults: function (start, stop) {
|
getLatestResults: function (start, stop) {
|
||||||
|
@ -187,47 +187,10 @@ define(
|
|||||||
input = document.getElementById(inputID).value;
|
input = document.getElementById(inputID).value;
|
||||||
|
|
||||||
// Get items list
|
// Get items list
|
||||||
//requestItems(); // Test out the worker
|
return getItems(timeout).then(function () {
|
||||||
return getItems(timeout).then(function (/*searchResultItems*/) {
|
// Then get the worker to search through it
|
||||||
|
|
||||||
workerSearch(input, maxResults, timestamp);
|
workerSearch(input, maxResults, timestamp);
|
||||||
return; // There's nothing we need to return here
|
return; // There's nothing we need to return here
|
||||||
|
|
||||||
/*
|
|
||||||
// Wait for latestResults to be not empty, then return
|
|
||||||
function wait(){
|
|
||||||
if (latestResults.length === 0){
|
|
||||||
console.log('waiting');
|
|
||||||
console.log('latestResults', latestResults);
|
|
||||||
$timeout(wait, 100);
|
|
||||||
} else {
|
|
||||||
console.log('done waiting');
|
|
||||||
//test = latestResults;
|
|
||||||
return latestResults;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
console.log('about to wait');
|
|
||||||
return wait();
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
// Keep track of the number of results to display
|
|
||||||
if (searchResultItems.length < maxResults) {
|
|
||||||
resultsLength = searchResultItems.length;
|
|
||||||
} else {
|
|
||||||
resultsLength = maxResults;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test out calling the web worker search
|
|
||||||
workerSearch(input, maxResults);
|
|
||||||
|
|
||||||
// Then filter through the items list
|
|
||||||
searchResults = filterResults(searchResultItems, input, resultsLength);
|
|
||||||
|
|
||||||
//console.log('filtered searchResults (in Everything)', searchResults);
|
|
||||||
return searchResults;
|
|
||||||
*/
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user