Zend certified PHP/Magento developer

Custom Sorting is not working in Magento 2.4.3-p1 – Product Graphql

0

I’m trying to create custom sorting for the product mutation.

Need a product sorting based on product ratings. Once i have override the MagentoCatalogGraphqlSearchAdapterQueryBuilderSort. It throwing a error .

I have added the following line to

 $sorts[] = [
            $fieldName => [
                'order' => strtolower($item['direction']), 'unmapped_type' => 'long'
            ]
        ];

Please let me know how to add a custom sort in magento graphql (Elastic search)