Smile\ElasticsuiteThesaurus\Model\ResourceModel\Indexer\Thesaurus::getSynonyms PHP Method

getSynonyms() public method

Build a list of synonyms into the Lucene format (foo,bar).
public getSynonyms ( integer $storeId ) : string[]
$storeId integer Store id.
return string[]
    public function getSynonyms($storeId)
    {
        $connection = $this->getConnection();
        $select = $this->getBaseSelect($storeId, ThesaurusInterface::TYPE_SYNONYM);
        $select->columns(['terms' => new \Zend_Db_Expr('GROUP_CONCAT(terms.term)')]);
        return $connection->fetchCol($select);
    }

Usage Example

Example #1
0
 /**
  * {@inheritDoc}
  */
 public function executeFull()
 {
     $storeIds = array_keys($this->storeManager->getStores());
     foreach ($storeIds as $storeId) {
         $synonyms = $this->resourceModel->getSynonyms($storeId);
         $expansions = $this->resourceModel->getExpansions($storeId);
         $this->indexHandler->reindex($storeId, $synonyms, $expansions);
     }
 }