/** * Update a given list of entity for a store * This method only update the fields concerned by this data provider * * @param int $storeId The store Id * @param array $entityIds The entity ids * * @return $this */ protected function _updateEntities($storeId, $entityIds) { $updateData = $this->getEntitiesData($storeId, $entityIds); $bulk = array(); foreach ($updateData as $entityId => $data) { $documentId = sprintf("%s|%s", $entityId, $storeId); $update = $this->getCurrentIndex()->updateDocument($documentId, $data, $this->_mapping->getType()); $bulk = array_merge($bulk, $update); } $this->getCurrentIndex()->executeBulk($bulk); return $this; }
/** * Get mapping properties as stored into the index * * @return array */ protected function _getMappingProperties() { $mapping = parent::_getMappingProperties(); $mapping['properties'] = array_merge($mapping['properties'], $this->_getSpellingFieldMapping()); $attributes = $this->_getAttributesById(); foreach ($attributes as $attribute) { $mapping['properties'] = array_merge($mapping['properties'], $this->_getAttributeMapping($attribute)); } $mapping['properties']['unique'] = array('type' => 'string', 'store' => false, 'index' => 'not_analyzed'); $mapping['properties']['id'] = array('type' => 'long', 'store' => false, 'index' => 'not_analyzed'); $mapping['properties']['store_id'] = array('type' => 'integer', 'store' => false, 'index' => 'not_analyzed'); return $mapping; }