filter:search.build hook

v1.18.x
Barış Soner Uşaklı 10 years ago
parent b40b87dd36
commit 57d6bb3b4c

@ -41,10 +41,9 @@ searchController.search = function(req, res, next) {
req.query.categories = [req.query.categories]; req.query.categories = [req.query.categories];
} }
req.query.in = req.query.in || 'posts'; var data = {
search.search({
query: req.params.term, query: req.params.term,
searchIn: req.query.in, searchIn: req.query.in || 'posts',
postedBy: req.query.by, postedBy: req.query.by,
categories: req.query.categories, categories: req.query.categories,
searchChildren: req.query.searchChildren, searchChildren: req.query.searchChildren,
@ -56,7 +55,9 @@ searchController.search = function(req, res, next) {
sortDirection: req.query.sortDirection, sortDirection: req.query.sortDirection,
page: page, page: page,
uid: uid uid: uid
}, function(err, results) { };
search.search(data, function(err, results) {
if (err) { if (err) {
return next(err); return next(err);
} }
@ -67,7 +68,13 @@ searchController.search = function(req, res, next) {
results.showAsTopics = req.query.showAs === 'topics'; results.showAsTopics = req.query.showAs === 'topics';
results.breadcrumbs = breadcrumbs; results.breadcrumbs = breadcrumbs;
results.categories = categories; results.categories = categories;
res.render('search', results);
plugins.fireHook('filter:search.build', {data: data, results: results}, function(err, data) {
if (err) {
return next(err);
}
res.render('search', data.results);
});
}); });
}); });
}; };

Loading…
Cancel
Save