How can i Get a product list order by relevance like the front office?
I want sort my search by name, price and relevance like the frontend.
The first two work perfectly but when $searchOrder is by relevance does not work properly. Always is the same result and different of frontoffice
<?php
$searchOrder = "relevance";
$searchDirection = ($searchDir == "desc") ? SortOrder::SORT_DESC : SortOrder::SORT_ASC;
$this->_searchCriteriaBuilder->addSortOrder($searchOrder, $searchDirection);
$searchCriteria = $this->_searchCriteriaBuilder->setCurrentPage($page)->setPageSize($pageSize)->create();
$products = $this->_productRepository->getList($searchCriteria);
$products = $products->getItems();
?>