mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
added indices on search key and id for mongo
This commit is contained in:
@@ -105,6 +105,12 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
db.collection('search').ensureIndex({key: 1, id: 1}, {background: true}, function(err) {
|
||||||
|
if(err) {
|
||||||
|
winston.error('Error creating index ' + err.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if(typeof callback === 'function') {
|
if(typeof callback === 'function') {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ module.exports = function(db, module) {
|
|||||||
content: content
|
content: content
|
||||||
};
|
};
|
||||||
|
|
||||||
db.collection('search').update({id:id, key:key}, {$set:data}, {upsert:true, w: 1}, function(err) {
|
db.collection('search').update({key:key, id:id}, {$set:data}, {upsert:true, w: 1}, function(err) {
|
||||||
if(err) {
|
if(err) {
|
||||||
winston.error('Error indexing ' + err.message);
|
winston.error('Error indexing ' + err.message);
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@ module.exports = function(db, module) {
|
|||||||
|
|
||||||
module.searchRemove = function(key, id, callback) {
|
module.searchRemove = function(key, id, callback) {
|
||||||
callback = callback || helpers.noop;
|
callback = callback || helpers.noop;
|
||||||
db.collection('search').remove({id:id, key:key}, callback);
|
db.collection('search').remove({key:key, id:id}, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.flushdb = function(callback) {
|
module.flushdb = function(callback) {
|
||||||
|
|||||||
Reference in New Issue
Block a user