Search API - SortBy metadata?
Is it possible to sort by a meta data field using the SDK? For example, a given metadata field might represent some property that you want to order your search results by.
-
Official comment
Hi Alan,
Cloudinary structured metadata allows you to define typed fields for media assets, populate them with values programmatically or via the Media Library, and perform searches on them. You can also add validation rules, set default values, and define fields as mandatory.
Click the link for the documentation of Metadata API.
It's possible to search for resources based on either embedded metadata or structured metadata using Cloudinary's search APIThe search API uses query language to search resources and it is possible to build complex expressions to base the search on.
Searching using structured metadata requires using the `metadata` field in the search expression.
You can see a full explanation and additional details on how to search using structured metadata in our documentation about search fields
Regards,
Akshay
-
The documentation is a bit vague on the definition for "field" used for the sort_by parameter.
So my specific question is can the "field" used by sort_by be the key of a contextual metadata key/value pair.
I've tried the following (where 'budget' is the key for contextual metadata):
context:budget
context.budget
But both result in errors when passed into SortBy like:
.SortBy("context:budget", "desc")
0 -
It has bee confirmed in a separate thread that sorting by metadata isn't possible at this time. Would love to see it in the future!
0 -
Hi Alan! I’m Jonathan, one of the Customer Success Managers here at Cloudinary. We’re always happy to get feedback and suggestions from our users.
In fact, you can help shape the future direction of our roadmap by submitting your feature request here: https://cloudinary.com/roadmap
On the bottom left page you’ll be able to click the + icon and submit a new idea.
If you have any other questions we’re always happy to help!
0
Post is closed for comments.
Comments
4 comments