mirror of
https://github.com/nasa/openmct.git
synced 2025-01-20 11:38:56 +00:00
[Search] Removed validType function
Removed the validType function which previously was a paraemter to the search providers. It was no longer used, and is not necissary.
This commit is contained in:
parent
fc123cd367
commit
1b5fbccc06
@ -42,14 +42,6 @@ define(
|
||||
*/
|
||||
function SearchAggregator(providers) {
|
||||
|
||||
// Determines if a searchResult object is a valid type
|
||||
// to be displayed as a final result. Is passed to the
|
||||
// search providers as an argument.
|
||||
function validType(model) {
|
||||
// Nothing is currently disallowed
|
||||
return true;
|
||||
}
|
||||
|
||||
// Remove extra objects that have the same ID
|
||||
function filterRepeats(results) {
|
||||
var ids = [],
|
||||
@ -161,7 +153,7 @@ define(
|
||||
for (var i = 0; i < providers.length; i += 1) {
|
||||
resultsPromises.push(
|
||||
providers[i].query(
|
||||
inputID, validType, DEFAULT_MAX_RESULTS, DEFUALT_TIMEOUT
|
||||
inputID, DEFAULT_MAX_RESULTS, DEFUALT_TIMEOUT
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -48,7 +48,6 @@ define(
|
||||
*/
|
||||
function ElasticsearchSearchProvider($http, objectService, ROOT) {
|
||||
// TODO: Fix the above docstring
|
||||
var validType = function () {return true;};
|
||||
|
||||
// Check to see if the input has any special options
|
||||
function isDefaultFormat(searchTerm) {
|
||||
@ -99,7 +98,7 @@ define(
|
||||
|
||||
// Processes results from the format that elasticsearch returns to
|
||||
// a list of objects in the format that mct-representation can use
|
||||
function processResults(rawResults, validType) {
|
||||
function processResults(rawResults) {
|
||||
var results = rawResults.data.hits.hits,
|
||||
resultsLength = results.length,
|
||||
ids = [],
|
||||
@ -130,15 +129,12 @@ define(
|
||||
|
||||
// Include items we can get models for
|
||||
if (objects[id].getModel) {
|
||||
// Check to see if they are allowed to be included
|
||||
if (validType(objects[id].getModel())) {
|
||||
// Format the results as searchResult objects
|
||||
searchResults.push({
|
||||
id: id,
|
||||
object: objects[id],
|
||||
score: scores[id]
|
||||
});
|
||||
}
|
||||
// Format the results as searchResult objects
|
||||
searchResults.push({
|
||||
id: id,
|
||||
object: objects[id],
|
||||
score: scores[id]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,15 +157,12 @@ define(
|
||||
*
|
||||
* @param inputID the name of the ID property of the html text
|
||||
* input where this funcion should find the search term
|
||||
* @param passedValidType (optional) a function which takes a
|
||||
* model for an object and determines if it is a valid type to
|
||||
* include in the final list of results; default returns true
|
||||
* @param maxResults (optional) the maximum number of results
|
||||
* that this function should return
|
||||
* @param timeout (optional) the time after which the search should
|
||||
* stop calculations and return partial results
|
||||
*/
|
||||
function queryElasticsearch(inputID, passedValidType, maxResults, timeout) {
|
||||
function queryElasticsearch(inputID, maxResults, timeout) {
|
||||
var searchTerm,
|
||||
esQuery;
|
||||
|
||||
@ -180,11 +173,6 @@ define(
|
||||
maxResults = DEFAULT_MAX_RESULTS;
|
||||
}
|
||||
|
||||
// Check to see if a valid type function was provided
|
||||
if (passedValidType) {
|
||||
validType = passedValidType;
|
||||
}
|
||||
|
||||
// Get the user input
|
||||
searchTerm = document.getElementById(inputID).value;
|
||||
|
||||
@ -204,7 +192,7 @@ define(
|
||||
url: esQuery
|
||||
}).then(function (rawResults) {
|
||||
// ...then process the data
|
||||
return processResults(rawResults, validType);
|
||||
return processResults(rawResults);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -44,8 +44,6 @@ define(
|
||||
* more easy creation of web workers.
|
||||
*/
|
||||
function GenericSearchProvider($rootScope, $timeout, objectService, workerService) {
|
||||
var validType = function () {return true;};
|
||||
|
||||
var worker = workerService.run('genericSearchWorker'),
|
||||
latestResults = [];
|
||||
|
||||
@ -263,15 +261,12 @@ define(
|
||||
*
|
||||
* @param inputID the name of the ID property of the html text
|
||||
* input where this funcion should find the search term
|
||||
* @param passedValidType (optional) a function which takes a
|
||||
* model for an object and determines if it is a valid type to
|
||||
* include in the final list of results; default returns true
|
||||
* @param maxResults (optional) the maximum number of results
|
||||
* that this function should return
|
||||
* @param timeout (optional) the time after which the search should
|
||||
* stop calculations and return partial results
|
||||
*/
|
||||
function queryGeneric(inputID, passedValidType, maxResults, timeout) {
|
||||
function queryGeneric(inputID, maxResults, timeout) {
|
||||
var input,
|
||||
terms = [],
|
||||
searchResults = [],
|
||||
@ -284,12 +279,6 @@ define(
|
||||
maxResults = DEFAULT_MAX_RESULTS;
|
||||
}
|
||||
|
||||
// Check to see if a valid type function was provided
|
||||
if (passedValidType) {
|
||||
validType = passedValidType;
|
||||
}
|
||||
|
||||
|
||||
// Get the user input
|
||||
input = document.getElementById(inputID).value;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user