/** * * {@inheritdoc} * */ public static function generateMapping(FieldType $current, $withPipeline) { if (!empty($current->getMappingOptions()) && !empty($current->getMappingOptions()['mappingOptions'])) { return [$current->getName() => $current->getMappingOptions()['mappingOptions']]; } return []; }
/** * Try to find (recursively) if there is a container where subfields must be reordered in the content type * * @param array $formArray * @param FieldType $fieldType */ private function reorderFields(array $formArray, FieldType $fieldType) { if (array_key_exists('reorder', $formArray)) { $keys = array_keys($formArray); /** @var FieldType $child */ foreach ($fieldType->getChildren() as $child) { if (!$child->getDeleted()) { $child->setOrderKey(array_search('ems_' . $child->getName(), $keys)); } } $this->addFlash('notice', 'Subfields in ' . $fieldType->getName() . ' has been prepared to be reordered'); return true; } else { /** @var FieldType $child */ foreach ($fieldType->getChildren() as $child) { if (!$child->getDeleted() && $this->reorderFields($formArray['ems_' . $child->getName()], $child)) { return true; } } } return false; }
/** * Build an elasticsearch mapping options as an array * * @param array $options * @param FieldType $current */ public static function generateMapping(FieldType $current, $withPipeline) { return [$current->getName() => array_merge(["type" => "string"], array_filter($current->getMappingOptions()))]; }
/** * * {@inheritdoc} * */ public static function generateMapping(FieldType $current, $withPipeline) { return [$current->getName() => ['type' => 'nested', 'properties' => []]]; }
/** * {@inheritdoc} */ public static function generatePipeline(FieldType $current) { return ["attachment" => ['field' => $current->getName() . '.content', 'target_field' => $current->getName() . '.attachment', 'indexed_chars' => 1000000]]; }
/** * {@inheritdoc} */ public static function generateMapping(FieldType $current, $withPipeline) { return [$current->getName() => array_merge(["type" => "nested", "properties" => ["mimetype" => ["type" => "string", "index" => "not_analyzed"], "sha1" => ["type" => "string", "index" => "not_analyzed"], "filename" => ["type" => "string"], "filesize" => ["type" => "integer"]]], array_filter($current->getMappingOptions()))]; }
/** * * {@inheritdoc} * */ public static function generateMapping(FieldType $current, $withPipeline) { return [$current->getName() => ["type" => "nested", "properties" => []]]; }
/** * * {@inheritdoc} * */ public static function generateMapping(FieldType $current, $withPipeline) { $out = [$current->getMappingOptions()['fromDateMachineName'] => ["type" => "date", "format" => 'date_time_no_millis'], $current->getMappingOptions()['toDateMachineName'] => ["type" => "date", "format" => 'date_time_no_millis']]; if (!empty($current->getMappingOptions()['index'])) { $current->getMappingOptions()['fromDateMachineName']['index'] = $current->getMappingOptions()['index']; $current->getMappingOptions()['toDateMachineName']['index'] = $current->getMappingOptions()['index']; } if ($current->getMappingOptions()['nested']) { $out = [$current->getName() => ["type" => "nested", "properties" => $out]]; } return $out; }