mirror of
https://github.com/nasa/openmct.git
synced 2025-06-21 08:39:59 +00:00
[Search] Comments
This commit is contained in:
@ -48,9 +48,10 @@ define(
|
|||||||
// array, and returns the number that were removed.
|
// array, and returns the number that were removed.
|
||||||
function filterDuplicates(results, total) {
|
function filterDuplicates(results, total) {
|
||||||
var ids = [],
|
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 (ids.indexOf(results[i].id) !== -1) {
|
||||||
// If this result's ID is already there, remove the object
|
// If this result's ID is already there, remove the object
|
||||||
results.splice(i, 1);
|
results.splice(i, 1);
|
||||||
|
@ -35,14 +35,6 @@ define(function () {
|
|||||||
var numResults = INITIAL_LOAD_NUMBER,
|
var numResults = INITIAL_LOAD_NUMBER,
|
||||||
fullResults = [];
|
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() {
|
function search() {
|
||||||
var inputText = $scope.ngModel.input;
|
var inputText = $scope.ngModel.input;
|
||||||
|
|
||||||
@ -57,9 +49,7 @@ define(function () {
|
|||||||
numResults = INITIAL_LOAD_NUMBER;
|
numResults = INITIAL_LOAD_NUMBER;
|
||||||
|
|
||||||
// Send the query
|
// Send the query
|
||||||
//searchService.sendQuery(inputText, setControllerResults);
|
|
||||||
searchService.query(inputText).then(function (result) {
|
searchService.query(inputText).then(function (result) {
|
||||||
//console.log('controller - results', results);
|
|
||||||
fullResults = result.hits;
|
fullResults = result.hits;
|
||||||
$scope.results = result.hits.slice(0, numResults);
|
$scope.results = result.hits.slice(0, numResults);
|
||||||
});
|
});
|
||||||
@ -95,7 +85,8 @@ define(function () {
|
|||||||
* Checks to see if there are more search results to display.
|
* Checks to see if there are more search results to display.
|
||||||
*/
|
*/
|
||||||
areMore: function () {
|
areMore: function () {
|
||||||
return numResults < fullResults.length;//searchService.getNumResults();
|
return numResults < fullResults.length;
|
||||||
|
// TODO: See loadMore() todo.
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -105,7 +96,8 @@ define(function () {
|
|||||||
loadMore: function () {
|
loadMore: function () {
|
||||||
numResults += LOAD_INCREMENT;
|
numResults += LOAD_INCREMENT;
|
||||||
$scope.results = fullResults.slice(0, numResults);
|
$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.
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user