need mongo 2.4+ for text search'

v1.18.x
Baris Soner Usakli 11 years ago
parent 53ca7a1143
commit e9fbab0f26

@ -69,22 +69,21 @@
// //
module.searchIndex = function(key, content, id) { module.searchIndex = function(key, content, id) {
// REQUIRES MONGO 2.4
db.collection('search').update({key:key, content:content, _id:id}, {upsert:true, w: 1}, function(err, result) { db.collection('search').update({key:key, content:content, _id:id}, {upsert:true, w: 1}, function(err, result) {
}); });
} }
module.search = function(key, term, callback) { module.search = function(key, term, callback) {
// REQUIRES MONGO 2.4
db.command({text:"search" , search: term }, function(err, result) { db.command({text:"search" , search: term }, function(err, result) {
callback(err, result) callback(err, result)
}); });
/*db.runCommand("text", { search: term }, function(err, result) {
callback(err, result);
});*/
} }
module.searchRemove = function(key, id) { module.searchRemove = function(key, id) {
// REQUIRES MONGO 2.4
db.collection('search').remove({_id:id}, function(err, result) { db.collection('search').remove({_id:id}, function(err, result) {
callback(err, result); callback(err, result);
}); });

Loading…
Cancel
Save