mongoose-paginate-v2
mongoose-paginate-v2 copied to clipboard
Cannot carry out a weighted text search
I am trying to apply the following query to the paginate function, but don't think it works.
var docItems = require('../models/docItems.js'); docItems.find( {$text: {$search: req.query.searchString}} , {score: {$meta: "textScore"}} ) .sort({ score : { $meta : 'textScore' } }) .exec(function(err, results) {
return next(err, results);
});
the , {score: {$meta: "textScore"}} line is what is missing in the following code:
docItems.paginate( {$text: {$search: req.query.searchString}, score: {$meta: "textScore"}}, { page: 1, sortBy: { score : { $meta : 'textScore' } }}, function(err, results, pageCount, itemCount) { console.log('hello'); return next(err, results, pageCount, itemCount); });
Is there a way to submit the score meta line? what am i missing?
@keniiy Haven't tried that. Let me see if this can be fixed.