There is 3rd party module that has the class called ExactMatch.
public function getExactMatch()
{
$params = $this->request->getParams();
if (!empty($params['q']))
{
$sku = strtoupper(urldecode($params['q']));
try {
$product = $this->productRepository->get($sku);
$result = ($product->getStatus() == 1) ? $product : 0;
} catch (MagentoFrameworkExceptionNoSuchEntityException $e) {
$result = 0;
}
}
return $result;
}
With the relative phtml template, it is responsible for acquiring product SKU and rendering a separate DIV (if SKU matches) that repeats how the regular product looks on list mode via helpers on the search page alongside other products.
Class itself extends ListProduct.
If I don’t override _getProductCollection with a filter that matches nothing, the regular query will fail trying to load 3.9k items.
Extending other class won’t help, otherwise the template calling functions that are in AbstractProduct will throw errors on null.