You can create your own sorter service by implementing the SorterInterface
interface.
For example, in your test application, we have a short description sorter.
Add the tag monsieurbiz.search.request.product_sorter
to your service.
In your services.yaml
file, you can replace the existing sorter by your own service.
services:
MonsieurBiz\SyliusSearchPlugin\Search\Request\Sorting\Product\PriceSorter:
class: App\Search\Request\Sorting\Product\PriceSorter
tags:
- { name: monsieurbiz.search.request.product_sorter }
Don't forget to create your class!
If you want to keep the logic but add code before and/or after, you can also decorate the service.
Override the sorting.html.twig template to add your sort.
A text field can't be used for sorting. In this case, you can create a "keyword" subfield.