mirror of
https://github.com/nasa/openmct.git
synced 2025-03-23 12:35:48 +00:00
[Search] Max results
Changed the default number of results to be a max of 25, and added a parameter to allow the user to set this. (May be used in an advaned search later?) Because folders are filtered out, the number displayed is not necissarily exact.
This commit is contained in:
parent
503811f69c
commit
1a8fd38430
@ -77,9 +77,16 @@ define(function () {
|
||||
}
|
||||
|
||||
// Use elasticsearch's search to search through all the objects
|
||||
function searchElastic(inputID) {
|
||||
function searchElastic(inputID, maxResults) {
|
||||
var searchTerm;
|
||||
|
||||
// Check to see if the user provided a maximum
|
||||
// number of results to display
|
||||
if (!maxResults) {
|
||||
// Else, we provide a default value
|
||||
maxResults = 25;
|
||||
}
|
||||
|
||||
// Get the user input
|
||||
if (inputID) {
|
||||
searchTerm = document.getElementById(inputID).value;
|
||||
@ -96,7 +103,8 @@ define(function () {
|
||||
// Get the data...
|
||||
return $http({
|
||||
method: "GET",
|
||||
url: ROOT + "/_search/?q=name:" + searchTerm
|
||||
url: ROOT + "/_search/?q=name:" + searchTerm +
|
||||
"&size=" + maxResults
|
||||
}).then(function (rawResults) {
|
||||
// ...then process the data
|
||||
var results = rawResults.data.hits.hits,
|
||||
|
Loading…
x
Reference in New Issue
Block a user