mirror of
https://github.com/nasa/openmct.git
synced 2025-02-20 17:33:23 +00:00
[Search] Comments
This commit is contained in:
parent
15b7e3ac9b
commit
f8471bc944
@ -48,9 +48,10 @@ define(
|
||||
// array, and returns the number that were removed.
|
||||
function filterDuplicates(results, total) {
|
||||
var ids = [],
|
||||
numRemoved = 0;
|
||||
numRemoved = 0,
|
||||
i;
|
||||
|
||||
for (var i = 0; i < results.length; i += 1) {
|
||||
for (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);
|
||||
|
@ -35,14 +35,6 @@ define(function () {
|
||||
var numResults = INITIAL_LOAD_NUMBER,
|
||||
fullResults = [];
|
||||
|
||||
/*
|
||||
// Function to be passed to the search service which allows it to set the
|
||||
// search template's results list
|
||||
function setControllerResults(results) {
|
||||
$scope.results = results.slice(0, numResults);
|
||||
}
|
||||
*/
|
||||
|
||||
function search() {
|
||||
var inputText = $scope.ngModel.input;
|
||||
|
||||
@ -57,9 +49,7 @@ define(function () {
|
||||
numResults = INITIAL_LOAD_NUMBER;
|
||||
|
||||
// Send the query
|
||||
//searchService.sendQuery(inputText, setControllerResults);
|
||||
searchService.query(inputText).then(function (result) {
|
||||
//console.log('controller - results', results);
|
||||
fullResults = result.hits;
|
||||
$scope.results = result.hits.slice(0, numResults);
|
||||
});
|
||||
@ -95,7 +85,8 @@ define(function () {
|
||||
* Checks to see if there are more search results to display.
|
||||
*/
|
||||
areMore: function () {
|
||||
return numResults < fullResults.length;//searchService.getNumResults();
|
||||
return numResults < fullResults.length;
|
||||
// TODO: See loadMore() todo.
|
||||
},
|
||||
|
||||
/**
|
||||
@ -105,7 +96,8 @@ define(function () {
|
||||
loadMore: function () {
|
||||
numResults += LOAD_INCREMENT;
|
||||
$scope.results = fullResults.slice(0, numResults);
|
||||
//searchService.refresh(setControllerResults);
|
||||
// TODO: Let load more see if total > fullResults.length, and then
|
||||
// if so, resend a query.
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user