[Search] Input checks
More checks to see if the input is empty before doing search computations.
This commit is contained in:
@@ -149,7 +149,7 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the user input is empty, we want to have no search results.
|
// If the user input is empty, we want to have no search results.
|
||||||
if (searchTerm !== '') {
|
if (searchTerm !== '' && searchTerm !== undefined) {
|
||||||
// Process the search term
|
// Process the search term
|
||||||
searchTerm = processSearchTerm(searchTerm);
|
searchTerm = processSearchTerm(searchTerm);
|
||||||
|
|
||||||
|
|||||||
@@ -191,6 +191,9 @@ define(
|
|||||||
searchResults = [],
|
searchResults = [],
|
||||||
defer = $q.defer();
|
defer = $q.defer();
|
||||||
|
|
||||||
|
// If the input is nonempty, do a search
|
||||||
|
if (input !== '' && input !== undefined) {
|
||||||
|
|
||||||
// Allow us to access this promise later to resolve it later
|
// Allow us to access this promise later to resolve it later
|
||||||
pendingQueries[timestamp] = defer;
|
pendingQueries[timestamp] = defer;
|
||||||
|
|
||||||
@@ -209,6 +212,10 @@ define(
|
|||||||
workerSearch(input, maxResults, timestamp, timeout);
|
workerSearch(input, maxResults, timestamp, timeout);
|
||||||
|
|
||||||
return defer.promise;
|
return defer.promise;
|
||||||
|
} else {
|
||||||
|
// Otherwise return an empty result
|
||||||
|
return {hits: [], total: 0};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Index the tree's contents once at the beginning
|
// Index the tree's contents once at the beginning
|
||||||
|
|||||||
Reference in New Issue
Block a user