From b5c263dd37829afc63c0e1ea572954094c4be062 Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 3 Dec 2012 01:41:01 +0000 Subject: [PATCH] improve search to use description too, bit more cpu heavy for thats okay --- src/static/js/pluginfw/installer.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/static/js/pluginfw/installer.js b/src/static/js/pluginfw/installer.js index d668e549..e491f077 100644 --- a/src/static/js/pluginfw/installer.js +++ b/src/static/js/pluginfw/installer.js @@ -91,9 +91,12 @@ exports.search = function(query, cache, cb) { if (er) return cb(er); var res = {}; var i = 0; - for (key in data) { + for (key in data) { // for every plugin in the data from npm if ( key.indexOf(plugins.prefix) == 0 - && key.indexOf(query.pattern) != -1) { + && key.indexOf(query.pattern) != -1 + || key.indexOf(plugins.prefix) == 0 + && data[key].description.indexOf(query.pattern) != -1 + ) { // If the name contains ep_ and the search string is in the name or description i++; if (i > query.offset && i <= query.offset + query.limit) {