mirror of
https://github.com/nasa/openmct.git
synced 2025-04-23 02:13:52 +00:00
[Search] Remove timeouts and timestamps
Remove timeouts and timestamps which were not effectively doing anything.
This commit is contained in:
parent
a2fce8e56c
commit
12efb47be7
platform
persistence/elastic/src
search/src/services
@ -142,7 +142,6 @@ define([
|
||||
return {
|
||||
hits: searchResults,
|
||||
total: response.data.hits.total,
|
||||
timedOut: response.data.timed_out
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -70,13 +70,11 @@ define([
|
||||
* Query the search provider for results.
|
||||
*
|
||||
* @param {String} input the string to search by.
|
||||
* @param {Number} timestamp part of the SearchProvider interface, ignored.
|
||||
* @param {Number} maxResults max number of results to return.
|
||||
* @returns {Promise} a promise for a modelResults object.
|
||||
*/
|
||||
GenericSearchProvider.prototype.query = function (
|
||||
input,
|
||||
timestamp,
|
||||
maxResults
|
||||
) {
|
||||
if (!maxResults) {
|
||||
@ -225,7 +223,6 @@ define([
|
||||
|
||||
var pendingQuery = this.pendingQueries[event.data.queryId],
|
||||
modelResults = {
|
||||
timedOut: event.data.timedOut,
|
||||
total: event.data.total
|
||||
};
|
||||
|
||||
|
@ -61,13 +61,12 @@
|
||||
|
||||
/**
|
||||
* Gets search results from the indexedItems based on provided search
|
||||
* input. Returns matching results from indexedItems, as well as the
|
||||
* timestamp that was passed to it.
|
||||
* input. Returns matching results from indexedItems
|
||||
*
|
||||
* @param data An object which contains:
|
||||
* * input: The original string which we are searching with
|
||||
* * maxResults: The maximum number of search results desired
|
||||
* * timestamp: The time identifier from when the query was made
|
||||
* * queryId: an id identifying this query, will be returned.
|
||||
*/
|
||||
function search(data) {
|
||||
// This results dictionary will have domain object ID keys which
|
||||
@ -79,7 +78,6 @@
|
||||
request: 'search',
|
||||
results: {},
|
||||
total: 0,
|
||||
timedOut: false,
|
||||
queryId: data.queryId
|
||||
},
|
||||
matches = {};
|
||||
|
@ -31,8 +31,7 @@ define([
|
||||
) {
|
||||
"use strict";
|
||||
|
||||
var DEFAULT_TIMEOUT = 1000,
|
||||
DEFAULT_MAX_RESULTS = 100;
|
||||
var DEFAULT_MAX_RESULTS = 100;
|
||||
|
||||
/**
|
||||
* Aggregates multiple search providers as a singular search provider.
|
||||
@ -57,7 +56,7 @@ define([
|
||||
/**
|
||||
* Sends a query to each of the providers. Returns a promise for
|
||||
* a result object that has the format
|
||||
* {hits: searchResult[], total: number, timedOut: boolean}
|
||||
* {hits: searchResult[], total: number}
|
||||
* where a searchResult has the format
|
||||
* {id: string, object: domainObject, score: number}
|
||||
*
|
||||
@ -87,9 +86,7 @@ define([
|
||||
resultPromises = this.providers.map(function (provider) {
|
||||
return provider.query(
|
||||
inputText,
|
||||
timestamp,
|
||||
maxResults,
|
||||
DEFAULT_TIMEOUT
|
||||
maxResults
|
||||
);
|
||||
});
|
||||
|
||||
@ -98,16 +95,13 @@ define([
|
||||
.then(function (providerResults) {
|
||||
var modelResults = {
|
||||
hits: [],
|
||||
totals: 0,
|
||||
timedOut: false
|
||||
totals: 0
|
||||
};
|
||||
|
||||
providerResults.forEach(function (providerResult) {
|
||||
modelResults.hits =
|
||||
modelResults.hits.concat(providerResult.hits);
|
||||
modelResults.totals += providerResult.totals;
|
||||
modelResults.timedOut =
|
||||
modelResults.timedOut || providerResult.timedOut;
|
||||
});
|
||||
|
||||
aggregator.orderByScore(modelResults);
|
||||
@ -195,8 +189,7 @@ define([
|
||||
.then(function (objects) {
|
||||
|
||||
var objectResults = {
|
||||
totals: modelResults.totals,
|
||||
timedOut: modelResults.timedOut
|
||||
totals: modelResults.totals
|
||||
};
|
||||
|
||||
objectResults.hits = modelResults
|
||||
|
Loading…
x
Reference in New Issue
Block a user