Example #1
0
 /**
  * List of enabled indexes
  *
  * @return \Mirasvit\Search\Model\Index[]
  */
 public function getIndexes()
 {
     if ($this->indexes == null) {
         $result = [];
         $collection = $this->indexCollectionFactory->create()->addFieldToFilter('is_active', 1)->setOrder('position', 'asc');
         /** @var \Mirasvit\Search\Model\Index $index */
         foreach ($collection as $index) {
             if ($this->config->isMultiStoreModeEnabled() && $index->getCode() == 'catalogsearch_fulltext') {
                 foreach ($this->_storeManager->getStores(false, true) as $code => $store) {
                     if (in_array($store->getId(), $this->config->getEnabledMultiStores())) {
                         $clone = clone $index;
                         $clone->setData('store_id', $store->getId());
                         $clone->setData('store_code', $code);
                         if ($this->_storeManager->getStore()->getId() != $store->getId()) {
                             $clone->setData('title', $store->getName());
                         }
                         $result[] = $clone;
                     }
                 }
             } else {
                 $result[] = $index;
             }
         }
         $this->indexes = $result;
     }
     return $this->indexes;
 }