mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-13 08:00:43 +01:00
tag search
This commit is contained in:
@@ -214,19 +214,8 @@ module.exports = function(Topics) {
|
||||
return callback(null, []);
|
||||
}
|
||||
|
||||
if (plugins.hasListeners('filter:tags.category')) {
|
||||
plugins.fireHook('filter:tags.category', {tags: [], cid: data.cid}, function(err, result) {
|
||||
if (data.query.length === 1) {
|
||||
callback(err, result.tags);
|
||||
} else {
|
||||
doSearch(err, result ? result.tags : null);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
db.getSortedSetRevRange('tags:topic:count', 0, -1, doSearch);
|
||||
}
|
||||
|
||||
function doSearch(err, tags) {
|
||||
db.getSortedSetRevRange('tags:topic:count', 0, -1, function(err, tags) {
|
||||
if (err) {
|
||||
return callback(null, []);
|
||||
}
|
||||
@@ -244,7 +233,7 @@ module.exports = function(Topics) {
|
||||
});
|
||||
|
||||
callback(null, matches);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user