[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:
shale 2015-07-14 10:56:52 -07:00
parent 503811f69c
commit 1a8fd38430

View File

@ -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,