Smile\ElasticsuiteThesaurus\Plugin\Query::aroundSave PHP Method

aroundSave() public method

Ensure the index is invalidated when synonyms are updated.
public aroundSave ( Magento\Search\Model\Query $subject, Closure $proceed ) : Magento\Search\Model\Query
$subject Magento\Search\Model\Query Saved query.
$proceed Closure Original save method.
return Magento\Search\Model\Query
    public function aroundSave(QueryModel $subject, \Closure $proceed)
    {
        $needReindex = $subject->dataHasChangedFor('synonym_for');
        $result = $proceed();
        if ($needReindex) {
            $this->indexerRegistry->get(ThesaurusIndexer::INDEXER_ID)->invalidate();
        }
        return $result;
    }