0.1.0 • Published 11 years ago
fulltongo v0.1.0
fulltongo - simple keyword text search plugin for mongoose
Provides metaphone keyword indexing and search for a schema for Mongoose documents. Strongly based on mongoose-fts and reds
Options:
fields: an array of paths you want watched and converted into keywords
Example:
var schema = new Schema({
name: { first: String, last: String, email: String },
tags: [String]
});
var opts = {};
opts.fields = ['name.first', 'name.last', 'name.email', 'tags'];
schema.plugin(app, opts);
var Person = mongoose.model('Person', schema);This will introduce a few things to the schemea.
- Every new save, will reindex the fields provided when this was created under the
_keywordspath. - A static
searchmethod is added that takes aqueryparameter and acallback - An indexAll method is added (this needs more testing) to index all existing documents in a collection
- An updateIndex that can be used to update the
_keywordspath as needed.
Notes
For now have a look at the tests to see how this works.
Mongoose Version
>= 2.x