/** * Get mapping properties as stored into the index * * @return array */ protected function _getMappingProperties() { $mapping = parent::_getMappingProperties(true); $mapping['properties']['categories'] = array('type' => 'long'); $mapping['properties']['in_stock'] = array('type' => 'integer'); foreach (Mage::app()->getStores() as $store) { $languageCode = Mage::helper('smile_elasticsearch')->getLanguageCodeByStore($store); $fieldMapping = $this->_getStringMapping('category_name_' . $languageCode, $languageCode, 'varchar', false); } // Append dynamic mapping for product category position field $fieldTemplate = array('match' => 'position_category_*', 'mapping' => array('type' => 'integer')); $mapping['dynamic_templates'][] = array('category_position' => $fieldTemplate); return $mapping; }
/** * Get mapping properties as stored into the index * * @return array */ protected function _getMappingProperties() { $mapping = parent::_getMappingProperties(true); $mapping['properties']['categories'] = array('type' => 'long', 'fielddata' => array('format' => 'doc_values')); $mapping['properties']['show_in_categories'] = array('type' => 'long', 'fielddata' => array('format' => 'doc_values')); $mapping['properties']['in_stock'] = array('type' => 'boolean', 'fielddata' => array('format' => 'doc_values')); foreach ($this->_stores as $store) { $languageCode = Mage::helper('smile_elasticsearch')->getLanguageCodeByStore($store); $fieldMapping = $this->_getStringMapping('category_name_' . $languageCode, $languageCode, 'string', true, true, true); $mapping['properties'] = array_merge($mapping['properties'], $fieldMapping); } $mapping['properties']['category_position'] = array('type' => 'nested', 'properties' => array('category_id' => array('type' => 'long', 'fielddata' => array('format' => 'doc_values')), 'position' => array('type' => 'long', 'fielddata' => array('format' => 'doc_values')))); // Append dynamic mapping for product prices and discount fields $fieldTemplate = array('match' => 'price_*', 'mapping' => array('type' => 'double', 'fielddata' => array('format' => 'doc_values'))); $mapping['dynamic_templates'][] = array('prices' => $fieldTemplate); $fieldTemplate = array('match' => 'has_discount_*', 'mapping' => array('type' => 'boolean', 'fielddata' => array('format' => 'doc_values'))); $mapping['dynamic_templates'][] = array('has_discount' => $fieldTemplate); $mappingObject = new Varien_Object($mapping); Mage::dispatchEvent('search_engine_product_mapping_properties', array('mapping' => $mappingObject)); return $mappingObject->getData(); }
/** * Get mapping properties as stored into the index * * @return array */ protected function _getMappingProperties() { $mapping = parent::_getMappingProperties(true); $mapping['properties']['path'] = array('type' => 'string'); return $mapping; }