예제 #1
0
 /**
  * Generate dynamic fields requests
  *
  * @return array
  */
 public function generate()
 {
     $requests = [];
     foreach ($this->indexPool->getAvailableIndexes() as $index) {
         $requests[$index->getCode()] = $this->generateQuickSearchRequest($index);
     }
     return $requests;
 }
예제 #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;
 }
예제 #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;
 }