Classic Magento issue.
One will go through colledge and then further self educate for a decade for all the programming principles, patterns and best practices and what not.
Eventually, one will debug and will get stuck with a question like this, myself included of course. Magento certainly does not make things easy for debug.
But, I think I got that code that sets the direction. I sadly present to you
and its method
public function setListOrders()
$category = $this->catalogLayer->getCurrentCategory();
/* @var $category \Magento\Catalog\Model\Category */
$availableOrders = $category->getAvailableSortByOptions();
$availableOrders['relevance'] = __('Relevance');
Now, you can perhaps change portions of it to
and when you hit your debug point
$dir = $this->getDefaultDirection();
and in the
configureToolbar method from
ListProduct you will see that
$dir value is
You would expect from Magento to not hard code parameters for such an important eCommerce feature as the search is, but still, there it is.