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