public function aroundGetNoteMessages(Result $resultBlock, \Closure $proceed)
    {
        $messages = $proceed();
        $query    = $this->queryFactory->get();

        $query->setNumResults($this->resultCount);
        $query->setIsSpellchecked(false);
        $isSpellcheck = $resultBlock->getListBlock()->getLoadedProductCollection()->isSpellchecked();

        if ($isSpellcheck && $this->resultCount > 0) {
            $messages[] = __(
                "No exact results found for: <b>'%1'</b>. The displayed items are the closest matches.",
                $this->catalogSearchData->getEscapedQueryText()
            );
            $query->setIsSpellchecked(true);
        }

        if ($this->canSaveQuery()) {
            $this->queryResource->saveSearchResults($query);
        }

        return $messages;
    }
public function aroundGetNoteMessages(Result $resultBlock, \Closure $proceed)
    {
        $messages = $proceed();
        $query    = $this->queryFactory->get();

        $query->setNumResults($this->resultCount);
        $query->setIsSpellchecked(false);
        $isSpellcheck = $resultBlock->getListBlock()->getLoadedProductCollection()->isSpellchecked();

        if ($isSpellcheck && $this->resultCount > 0) {
            $messages[] = __(
                "No exact results found for: <b>'%1'</b>. The displayed items are the closest matches.",
                $this->catalogSearchData->getEscapedQueryText()
            );
            $query->setIsSpellchecked(true);
        }

        if ($this->canSaveQuery()) {
            $this->queryResource->saveSearchResults($query);
        }

        return $messages;
    }
public function aroundGetNoteMessages ( Result $ resultBlock , \ Closure $ proceed ) { $ messages = $ proceed ( ) ; $ query = $ this -> queryFactory -> get ( ) ; $ query -> setNumResults ( $ this -> resultCount ) ; $ query -> setIsSpellchecked ( false ) ; $ isSpellcheck = $ resultBlock -> getListBlock ( ) -> getLoadedProductCollection ( ) -> isSpellchecked ( ) ; if ( $ isSpellcheck && $ this -> resultCount > 0 ) { $ messages [ ] = __ ( "No exact results found for: <b>'%1'</b>. The displayed items are the closest matches." , $ this -> catalogSearchData -> getEscapedQueryText ( ) ) ; $ query -> setIsSpellchecked ( true ) ; } if ( $ this -> canSaveQuery ( ) ) { $ this -> queryResource -> saveSearchResults ( $ query ) ; } return $ messages ; }
Append the fuzziness alert message + save the search result count.

@SuppressWarnings(PHPMD.UnusedFormalParameter)

@param \Magento\CatalogSearch\Block\Result $resultBlock Result block.
@param \Closure                            $proceed     Original method.

@return string[]
Append the fuzziness alert message + save the search result count .