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