/** * Available indexes * * @return DataObject[] */ public function getIndexes() { $indexes = $this->dataHelper->getAvailableIndexes(); foreach ($indexes as $index) { $index->addData(['is_active' => $this->getValue($index, 'is_active'), 'limit' => $this->getValue($index, 'limit'), 'order' => $this->getValue($index, 'order')]); } usort($indexes, function ($a, $b) { return $a->getData('order') - $b->getData('order'); }); return $indexes; }
/** * List of indexes * * @return array */ public function getIndexes() { $indexes = $this->dataHelper->getEnabledIndexes(); foreach ($indexes as $index) { $indexClass = '\\Mirasvit\\Search\\Model\\Index'; if ($index instanceof $indexClass) { $index->setData('search_collection', $index->getSearchCollection()); } else { /** @var \Magento\Framework\DataObject $index */ if ($index->getData('code') == 'catalogsearch_fulltext') { $index->setData('search_collection', $this->layerResolver->get()->getProductCollection()); } elseif ($index->getData('code') == 'magento_search_query') { $index->setData('search_collection', $this->queryCollectionFactory->create()->setQueryFilter($this->query->getQueryText())->addFieldToFilter('query_text', ['neq' => $this->query->getQueryText()])->addStoreFilter([$this->storeManager->getStore()->getId()])->setOrder('popularity')->distinct(true)); } } } return $indexes; }