去掉了 keyword

This commit is contained in:
Alsotang 2014-04-22 16:19:06 +08:00
parent 083b85c3b6
commit f03c88f97d
2 changed files with 1 additions and 11 deletions

View File

@ -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'));
// 取排行榜上的用户

View File

@ -11,7 +11,7 @@
topics: topics,
pages: pages,
current_pages: current_page,
base: keyword ? ('/?q=' + keyword) : '/'
base: '/'
}) %>
</div>
<% } else { %>