Commit 40b088d6 by Torkel Ödegaard

Merge pull request #900 from mikhailov/patch-2

Speed search result parsing
parents f1125d64 67fde172
...@@ -224,7 +224,7 @@ function (angular, _, config, kbn, moment) { ...@@ -224,7 +224,7 @@ function (angular, _, config, kbn, moment) {
var endsInOpen = function(string, opener, closer) { var endsInOpen = function(string, opener, closer) {
var character; var character;
var count = 0; var count = 0;
for (var i=0; i<string.length; i++) { for (var i = 0, len = string.length; i < len; i++) {
character = string[i]; character = string[i];
if (character === opener) { if (character === opener) {
...@@ -279,18 +279,20 @@ function (angular, _, config, kbn, moment) { ...@@ -279,18 +279,20 @@ function (angular, _, config, kbn, moment) {
return { dashboards: [], tags: [] }; return { dashboards: [], tags: [] };
} }
var hits = { dashboards: [], tags: results.facets.tags.terms || [] }; var resultsHits = results.hits;
var displayHits = { dashboards: [], tags: results.facets.tags.terms || [] };
for (var i = 0; i < results.hits.hits.length; i++) { for (var i = 0, len = resultsHits.total; i < len; i++) {
hits.dashboards.push({ var hit = resultsHits.hits[i];
id: results.hits.hits[i]._id, displayHits.dashboards.push({
title: results.hits.hits[i]._source.title, id: hit._id,
tags: results.hits.hits[i]._source.tags title: hit._source.title,
tags: hit._source.tags
}); });
} }
hits.tagsOnly = tagsOnly; displayHits.tagsOnly = tagsOnly;
return hits; return displayHits;
}); });
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment