pavelvlasov / mongoose-search-plugin Goto Github PK
View Code? Open in Web Editor NEWFull text search plugin for mongoose
License: MIT License
Full text search plugin for mongoose
License: MIT License
var stemmer = natural[options.stemmer || 'PorterStemmer'],
^
TypeError: Cannot read property 'stemmer' of undefined
at module.exports (/home/Downloads/Web-Dev/Projects/sam-app/node_modules/mongoose-search-plugin/index.js:8:3
1)
at Object. (/home/Downloads/Web-Dev/Projects/sam-app/models/reports.js:36:15)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/home/Downloads/Web-Dev/Projects/sam-app/routes/index.js:21:14)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/home/Downloads/Web-Dev/Projects/sam-app/app.js:15:21)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
Program node bin/www exited with code 1
If I use MySchema.plugin(searchPlugin,...) before statics methods declaration, the plugin won't load.
But when I move it after statics declaration, it works:
MySchema.statics = {
list: function (options, cb) {
var criteria = options.criteria || {}
this.find(criteria)
.sort({'createdAt': -1}) // sort by date
.limit(options.perPage)
.skip(options.perPage * options.page)
.exec(cb);
}
}
MySchema.plugin(searchPlugin, {
fields: ['title', 'authors']
});
Hi,
I have a problem with some words in French. For exemple: "récépissé" which is transformed to "piss". So "ré", "cé" and the last character "é" are being removed.
Do you have an option to resolve this problem ?
Thanks !
What happens if I want to update keywords in a 'PUT' method where I update one document. The setKeywords method updates all the documents of the collection which can be particularly slow. The updateKeywords is a synchronous function which cannot be called with a callback and thus cannot be used. Any ideas?
Node version: v6.9.4
I'm using Electron cross platform.
ERROR:
TypeError: text.split is not a function at AggresiveTokenizer.tokenize ...
at stemmer.tokenizeAndStem ...
at Function.schema.statics.search (...\mongoose-search-plugin\index.js: 36:26) ...
I probe it in a new Model in the database, and I don't use the .setKeywords
I am using this plugin on an existing collection. As the documentation states, I run
Model.setKeywords(function(err) {
// ...
});
to initialize the keywords field, how ever I populated this collection using mongoimport which will not run any validation or middleware present on the schema. When Model.setKeywords run, I get validation error on fields that fail validation. I replaced lines 133 - 136 with
doc.collection.insert(function(err) {
if (err) console.log('[mongoose search plugin err] ', err, err.stack);
done();
});
I know this uses MongoDB native driver directly. It seems to solve my problem. I looked through the source code, I hope this doesnt break anything else. Is there a better way to solve this?
When my account was compromised a spam issue was created in this repo. I sincerely apologize. Cleaning up such issues via script.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.