You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the above query the score property is only exposed by passing the 2nd argument to Product.find() which assigns $meta: 'textScore' to score, making it available to sort by
You can't currently search against a text search using this plugin as you can't pass extra options to find by any means
If you attempt to emulate this and do a query: /Product?query={"$text":{"$search":"deli"}}&sort={"score":{"$meta":"textScore"}}
It throws an error (Can't canonicalize query: BadValue must have $meta projection for all $meta sort keys) which seems to be a direct result of the missing option
Is there any plan to support this functionality?
The text was updated successfully, but these errors were encountered:
What I've done for full-text search is implement a separate endpoint such as /search/v1. That said, I agree that it would be incredibly convenient to be able to do it directly from the API!
This is actually a problem I am tackling at the moment as our current method is high maintenance since we have to keep queries in sync across two different modules. I'm thinking of something along those lines,
Mongodb supports a text index
You use it in mongoose by enabling an extra key on the
find()
operation:In the above query the
score
property is only exposed by passing the 2nd argument toProduct.find()
which assigns$meta: 'textScore'
toscore
, making it available to sort byYou can't currently search against a text search using this plugin as you can't pass extra options to
find
by any meansIf you attempt to emulate this and do a query:
/Product?query={"$text":{"$search":"deli"}}&sort={"score":{"$meta":"textScore"}}
It throws an error (Can't canonicalize query: BadValue must have $meta projection for all $meta sort keys) which seems to be a direct result of the missing option
Is there any plan to support this functionality?
The text was updated successfully, but these errors were encountered: