var TextSearch = require('mongoose-text-search');
var LocalSchema = new Schema({
profile: { type: Number, index: true, required: true },
desiredJobs: { type: [], index: true, fulltext: true, aggregate: true }
...
... });
// give our schema text search capabilities
LocalSchema.plugin(TextSearch);
// add a text index to the tags array
LocalSchema.index({searchIdx: 'text'},{default_language: "portuguese"});
var model = Mongoose.model('curriculum', LocalSchema);
var domain = {
textSearch: function(term, options, cb) {
model.textSearch(term, options, cb);
}
};
module.exports = domain;
var options = {
limit: 10,
language: 'portuguese'
}
Curriculum.textSearch('qualificacoes',options, function (err, output) {
if (err){
console.log(err);
done();
}else{
console.log(output);
done();
}
});
Mongoose.connect(ServerConfig.db.host, function (error) {
Schema.textSearch(...);
});
Hi, just a quick check - are you running mongod with text-search enabled? Like this:
mongod --setParameter textSearchEnabled=true
--
Documentation - http://mongoosejs.com/
Plugins - http://plugins.mongoosejs.com/
Bug Reports - http://github.com/learnboost/mongoose
Production Examples - http://mongoosejs.tumblr.com/
StackOverflow - http://stackoverflow.com/questions/tagged/mongoose
Google Groups - https://groups.google.com/forum/?fromgroups#!forum/mongoose-orm
Twitter - https://twitter.com/mongoosejs
IRC - #mongoosejs
---
You received this message because you are subscribed to the Google Groups "Mongoose Node.JS ODM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongoose-orm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Samuel Castro
Full Stack Developer
(37) 9110-8850
To unsubscribe from this group and stop receiving emails from it, send an email to mongoose-orm+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to mongoose-orm...@googlegroups.com.