/** * Returns Elasticsearch engine config data. * * @param string $prefix Configuration prefix to be loaded (not used but present for compatibility) * @param mixed $store Store we want the configuration for * * @return array */ public function getEngineConfigData($prefix = '', $store = null) { $config = parent::getEngineConfigData('elasticsearch_', $store); $servers = array(); foreach (explode(',', $config['servers']) as $server) { $servers[] = $server; } $config['hosts'] = $servers; return $config; }
/** * Get mapping properties as stored into the index * * @param string $useCache Indicates if the cache should be used or if the mapping should be rebuilt. * * @return array */ public function getMappingProperties($useCache = true) { $indexName = $this->getCurrentIndex()->getCurrentName(); $cacheKey = 'SEARCH_ENGINE_MAPPING_' . $indexName . $this->_type; if ($this->_mapping == null && $useCache) { $mapping = Mage::app()->loadCache($cacheKey); if ($mapping) { $this->_mapping = unserialize($mapping); } } if ($this->_mapping === null) { $this->_mapping = $this->_loadMappingFromIndex(); if ($this->_mapping === null) { $this->_mapping = $this->_getMappingProperties(); } $mapping = serialize($this->_mapping); Mage::app()->saveCache($mapping, $cacheKey, array('CONFIG', 'EAV_ATTRIBUTE'), $this->_helper->getCacheLifetime()); } return $this->_mapping; }