From 27c74103182d85e0ac3101b10c511f15e07723ac Mon Sep 17 00:00:00 2001 From: shale Date: Tue, 14 Jul 2015 12:39:00 -0700 Subject: [PATCH] [Search] Moved hard coding Moved where the search type is prepended to the search term, to allow future changes to it. --- platform/features/search/src/QueryService.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platform/features/search/src/QueryService.js b/platform/features/search/src/QueryService.js index f3df7200b1..a24c5f5292 100644 --- a/platform/features/search/src/QueryService.js +++ b/platform/features/search/src/QueryService.js @@ -144,7 +144,7 @@ define( // Allow exact searches by checking to see if the first and last // chars are quotes. if ((searchTerm.substr(0, 1) === '"' && searchTerm.substr(searchTerm.length - 1, 1) === '"') || - (searchTerm.substr(0, 1) === "'" && searchTerm.substr(searchTerm.length - 1, 1) === "'")) { + (searchTerm.substr(0, 1) === "'" && searchTerm.substr(searchTerm.length - 1, 1) === "'")) { // Remove the quotes, because of how elasticsearch processses. // This will mean that elasticsearch will return any object that has // that searchTerm as a part of the name _separated by spaces_. @@ -158,11 +158,13 @@ define( // '*sine* OR *telemetry*' searchTerm = '*' + searchTerm + '*'; } + // Assume that the search term is for the name by default + searchTerm = "name:" + searchTerm; // Get the data... return $http({ method: "GET", - url: ROOT + "/_search/?q=name:" + searchTerm + + url: ROOT + "/_search/?q=" + searchTerm + "&size=" + maxResults }).then(function (rawResults) { // ...then process the data