Is it possible to sort paginated results by fulltext's textScore meta data?
trancephorm opened this issue · comments
Please anyone tell me if he actually did it, I don't want to lose days just to realize you can't do it. Thanks! :)
Seems like I managed to get paginated results sorted by textScore by default, now I just need to confirm it, anyone help me how to include textScore metadata in resultset?
You can add text score in projection for this,
projection: { score: { $meta: "textScore" } }
Thanks a lot, I've put it in options and it works... I'm now just curious how it doesn't replace the current result set with just that one score: property, because this is where it says that projection is overwriting current collection of properties: https://mongoosejs.com/docs/api/query.html#query_Query-projection
Glad to hear that solved your problem. Regarding your other question, that's outside the scope of this plugin. May you will find an answer in the mongoose/mongodb community.