/**
  * Generate dynamic fields requests
  *
  * @return array
  */
 public function generate()
 {
     $requests = [];
     foreach ($this->indexPool->getAvailableIndexes() as $index) {
         $requests[$index->getCode()] = $this->generateQuickSearchRequest($index);
     }
     return $requests;
 }
Beispiel #2
0
 /**
  * To option array
  *
  * @param bool $onlyUnused
  * @return array
  */
 public function toOptionArray($onlyUnused = false)
 {
     $options = [];
     foreach ($this->pool->getAvailableIndexes() as $index) {
         $code = $index->getCode();
         if (!$onlyUnused || !$this->indexCollection->getItemByColumnValue('code', $code)) {
             $options[$code] = $index->toString();
         }
     }
     return $options;
 }
Beispiel #3
0
 /**
  * @return \Mirasvit\Search\Model\Index\AbstractIndex
  * @throws \Exception
  */
 public function getIndexInstance()
 {
     if (!$this->indexInstance) {
         $code = $this->getData('code');
         $this->indexInstance = $this->indexPool->get($code);
         if (!$this->indexInstance) {
             throw new \Exception(__("Instance for '%1' not found", $code));
         }
         $this->indexInstance->setData($this->getData())->setModel($this);
     }
     return $this->indexInstance;
 }