I have a custom attribute (text field) - let's call it "size". It contains numeric values like 1,2,3,10,20,30. Products are sorted by this attribute on the category page.
Expected sort order:
1,2,3,10,20,30
Actual sort order:
1,10,2,20,3,30
I found this general answer which describes a general solution (not Magento related): https://stackoverflow.com/questions/8557172/mysql-order-by-sorting-alphanumeric-correctly
There seems to be a solution for Magento 1.9: https://stackoverflow.com/questions/22260419/magento-sort-attribute-by-decimal-not-alphanumerically
So here is my question: How can I achieve a natural sort order for attributes that contain numbers in Magento 2 on the category page?