mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +01:00
Merge pull request #1248 from ether/improved-search
Improve plugin search uses modules descriptions too now, bit more cpu heavy, but that's okay
This commit is contained in:
commit
17fb60e483
1 changed files with 5 additions and 2 deletions
|
@ -91,9 +91,12 @@ exports.search = function(query, cache, cb) {
|
||||||
if (er) return cb(er);
|
if (er) return cb(er);
|
||||||
var res = {};
|
var res = {};
|
||||||
var i = 0;
|
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
|
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++;
|
i++;
|
||||||
if (i > query.offset
|
if (i > query.offset
|
||||||
&& i <= query.offset + query.limit) {
|
&& i <= query.offset + query.limit) {
|
||||||
|
|
Loading…
Reference in a new issue