Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot carry out a weighted text search #170

Open
keniiy opened this issue Apr 28, 2022 · 1 comment
Open

Cannot carry out a weighted text search #170

keniiy opened this issue Apr 28, 2022 · 1 comment
Assignees
Labels
workingon Working On

Comments

@keniiy
Copy link

keniiy commented Apr 28, 2022

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?

@aravindnc
Copy link
Owner

@keniiy Haven't tried that. Let me see if this can be fixed.

@aravindnc aravindnc self-assigned this Jun 8, 2022
@aravindnc aravindnc added the workingon Working On label Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
workingon Working On
Projects
None yet
Development

No branches or pull requests

2 participants