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;
    }
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;
    }
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 ; }
Ensure the index is invalidated when synonyms are updated.

@param QueryModel $subject Saved query.
@param \Closure   $proceed Original save method.

@return QueryModel
Ensure the index is invalidated when synonyms are updated .