[NEW Feature]Sorting facets alphabetically
I would like to suggest to add support for sort facets returned alphabetically and not only by frequency as in solr or elastic. A parameter like facet_sort_by: freq or apha and having desc/ asc as option as we have for sort_by
Thank you
@drigolin This is a good suggestion. We will add to our roadmap.
Any news on this feature?
I also came here to suggest this same and found this thread.
This would be well received and its possibly a minor change on TS side. Of course, this can be done client side before display, but that's a bit fiddly and its possible more elegant to just get it in the API.
I would like to add the following idea:
Assume we are faceting for a nested fields, it would be great if we could sort by another value of that nested field for example:
ingredients: [{ "name": "Chicken", "calories": 100 }]
If we could sort ingredients.name by ingredients.calories that would be amazing.
This way we could show more relevant results for a facet like:
"Exclude high calorie ingredients"
Both alpha sorting and sorting facets on the value of another field available on 0.26.0.rc20. Usage:
Sorting alphabetically:
"facet_by": "phone(sort_by: _alpha:asc)"
Sorting facets by another field's value:
Given an object like this:
{
"id": "0",
"recipe": {
"name": "pizza",
"calories": 270
}
}
You can sort the facet values for recipe.name by the calories this way:
"facet_by": "recipe.name(sort_by: recipe.calories:asc)"
Thank you! Waiting for release in the cloud.
You can already use it in Typesense Cloud, by going to Cluster Configuration > Modify and picking the latest 0.26.0.rc at the bottom of the Version dropdown.
Released in v26