We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 49dbde5 commit 0096824Copy full SHA for 0096824
models/Users.js
@@ -59,7 +59,8 @@ var Schema = db.Schema(schemaObject);
59
// Schema.index({'tags': 'text'});
60
61
Schema.statics.search = function(string) {
62
- return this.find({$text: {$search: string}});
+ return this.find({$text: {$search: string}}, { score : { $meta: "textScore" } })
63
+ .sort({ score : { $meta : 'textScore' } });
64
};
65
66
// assign a function to the "methods" object of our Schema
0 commit comments