mirror of
https://github.com/cnodejs/nodeclub.git
synced 2025-12-08 19:55:55 +00:00
去掉了 keyword
This commit is contained in:
parent
083b85c3b6
commit
f03c88f97d
@ -17,11 +17,6 @@ var EventProxy = require('eventproxy');
|
||||
|
||||
exports.index = function (req, res, next) {
|
||||
var page = parseInt(req.query.page, 10) || 1;
|
||||
var keyword = req.query.q || ''; // in-site search
|
||||
if (Array.isArray(keyword)) {
|
||||
keyword = keyword.join(' ');
|
||||
}
|
||||
keyword = keyword.trim();
|
||||
var limit = config.list_topic_count;
|
||||
|
||||
var proxy = EventProxy.create('topics', 'tops', 'no_reply_topics', 'pages',
|
||||
@ -33,17 +28,12 @@ exports.index = function (req, res, next) {
|
||||
tops: tops,
|
||||
no_reply_topics: no_reply_topics,
|
||||
pages: pages,
|
||||
keyword: keyword
|
||||
});
|
||||
});
|
||||
proxy.fail(next);
|
||||
|
||||
var options = { skip: (page - 1) * limit, limit: limit, sort: [ ['top', 'desc' ], [ 'last_reply_at', 'desc' ] ] };
|
||||
var query = {};
|
||||
if (keyword) {
|
||||
keyword = keyword.replace(/[\*\^\&\(\)\[\]\+\?\\]/g, '');
|
||||
query.title = new RegExp(keyword, 'i');
|
||||
}
|
||||
// 取主题
|
||||
Topic.getTopicsByQuery(query, options, proxy.done('topics'));
|
||||
// 取排行榜上的用户
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
topics: topics,
|
||||
pages: pages,
|
||||
current_pages: current_page,
|
||||
base: keyword ? ('/?q=' + keyword) : '/'
|
||||
base: '/'
|
||||
}) %>
|
||||
</div>
|
||||
<% } else { %>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user