mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 03:55:55 +01:00
some fixes for search plugin
This commit is contained in:
@@ -90,9 +90,7 @@ var winston = require('winston'),
|
||||
|
||||
topics.setTopicField(tid, 'thumb', options.topic_thumb);
|
||||
|
||||
db.searchRemove('topic', tid, function() {
|
||||
db.searchIndex('topic', title, tid);
|
||||
});
|
||||
plugins.fireHook('action:topic.edit', tid);
|
||||
}
|
||||
|
||||
posts.getPostData(pid, function(err, postData) {
|
||||
|
||||
@@ -92,10 +92,10 @@ var db = require('./database'),
|
||||
return next(err);
|
||||
}
|
||||
|
||||
postData.content = content;
|
||||
|
||||
plugins.fireHook('action:post.save', postData);
|
||||
|
||||
postData.content = content;
|
||||
|
||||
next(null, postData);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -393,15 +393,13 @@ var path = require('path'),
|
||||
return res.redirect('/404');
|
||||
}
|
||||
|
||||
var limit = 50;
|
||||
|
||||
function searchPosts(callback) {
|
||||
Plugins.fireHook('filter:search.query', {
|
||||
index: 'post',
|
||||
query: req.params.terms
|
||||
query: req.params.term
|
||||
}, function(err, pids) {
|
||||
if (err) {
|
||||
return callback(err, null);
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
posts.getPostSummaryByPids(pids, false, callback);
|
||||
@@ -411,10 +409,10 @@ var path = require('path'),
|
||||
function searchTopics(callback) {
|
||||
Plugins.fireHook('filter:search.query', {
|
||||
index: 'topic',
|
||||
query: req.params.terms
|
||||
query: req.params.term
|
||||
}, function(err, tids) {
|
||||
if (err) {
|
||||
return callback(err, null);
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
topics.getTopicsByTids(tids, 0, callback);
|
||||
|
||||
Reference in New Issue
Block a user