Skip to content

Node.js based forum software built for the modern web

stop searching after finding 20

barisusaklifdf2cb6f8188
diff --git a/src/topics/tags.js b/src/topics/tags.js
index 50db8ccede..4d8e01b912 100644
--- a/src/topics/tags.js
+++ b/src/topics/tags.js
@@ -294,10 +294,13 @@ module.exports = function(Topics) {
for(var i=0; i<tags.length; ++i) {
if (tags[i].toLowerCase().startsWith(data.query)) {
matches.push(tags[i]);
+ if (matches.length > 19) {
+ break;
+ }
}
}
- matches = matches.slice(0, 20).sort(function(a, b) {
+ matches = matches.sort(function(a, b) {
return a > b;
});