Esempio n. 1
0
 public static function createFromLegacyField(databox_field $field)
 {
     $type = self::getTypeFromLegacy($field);
     $databox = $field->get_databox();
     // Thesaurus concept inference
     $xpath = $field->get_tbranch();
     if ($type === Mapping::TYPE_STRING && !empty($xpath)) {
         $roots = ThesaurusHelper::findConceptsByXPath($databox, $xpath);
     } else {
         $roots = null;
     }
     // Facet (enable + optional limit)
     $facet = $field->getFacetValuesLimit();
     if ($facet === databox_field::FACET_DISABLED) {
         $facet = self::FACET_DISABLED;
     } elseif ($facet === databox_field::FACET_NO_LIMIT) {
         $facet = self::FACET_NO_LIMIT;
     }
     return new self($field->get_name(), $type, ['searchable' => $field->is_indexable(), 'private' => $field->isBusiness(), 'facet' => $facet, 'thesaurus_roots' => $roots, 'used_by_collections' => $databox->get_collection_unique_ids()]);
 }