Sort by attribute value

hey guys! I’m having a similar question as this individual on this thread: Sorting/ranking by an attribute string value?

The solution recommended by the team was to look into optionalFilters. However, I don’t think this works for my use case, as for me, I have a property on my record called type, like so:

{
   type: 'a' | 'b' | 'c' | 'd'
}

I would like to always display my results with all records with value a first, then all results with attribute b, and so forth and so on.

Is there a way for me to do this?

One way I think could work would be to make boost rules that boost results with attributes in that order.

However, when I do this, I run into problems creating the rule, as shown in the photo.