/** * Return fields to be indexed in Solr * * @return string[] */ public function toSolrArray() { $data = []; $lang = $this->getDefaultLanguage(); $title = $this->getTitle(false, $lang); if ($this->getDriverParam('splitTitles', false)) { $titlePart = MetadataUtils::splitTitle($title); if ($titlePart) { $data['description'] = $title; $title = $titlePart; } } $data['title'] = $data['title_short'] = $data['title_full'] = $title; $allTitles = $this->getTitle(false); foreach (explode('; ', $allTitles) as $title) { if ($title != $data['title']) { $data['title_alt'][] = $title; } } $data['title_sort'] = $this->getTitle(true, $lang); $description = $this->getDescription(); if ($description) { if (!empty($data['description']) && strncmp($data['description'], $description, strlen($data['description']))) { $data['description'] .= " -- {$description}"; } else { $data['description'] = $description; } } $data['format'] = $this->getObjectWorkType(); $data['institution'] = $this->getLegalBodyName(); $data['author'] = $this->getActor($this->mainEvent); $data['author-letter'] = $data['author']; $data['topic'] = $data['topic_facet'] = $this->getSubjectTerms(); $data['material'] = $this->getEventMaterials($this->mainEvent); // This is just the display measurements! There's also the more granular // form, which could be useful for some interesting things eg. sorting by // size $data['measurements'] = $this->getMeasurements(); $data['identifier'] = $this->getIdentifier(); $data['culture'] = $this->getCulture(); $data['rights'] = $this->getRights(); $data['era'] = $data['era_facet'] = $this->getEventDisplayDate($this->mainEvent); $data['geographic_facet'] = []; $eventPlace = $this->getEventDisplayPlace($this->usagePlaceEvent); if ($eventPlace) { $data['geographic_facet'][] = $eventPlace; } $data['geographic_facet'] = array_merge($data['geographic_facet'], $this->getSubjectDisplayPlaces()); $data['geographic'] = $data['geographic_facet']; // Index the other place forms only to facets $data['geographic_facet'] = array_merge($data['geographic_facet'], $this->getSubjectPlaces()); $data['collection'] = $this->getRelatedWorkDisplayObject($this->relatedWorkRelationTypes); $urls = $this->getURLs(); if (count($urls)) { // thumbnail field is not multivalued so can only store first image url $data['thumbnail'] = $urls[0]; } $data['allfields'] = $this->getAllFields($this->doc); return $data; }