public function getSuggestedLinksForRegistryObject(_registry_object $registry_object, $start, $rows)
 {
     // First, get published records with the same identifier as us
     // Note: whilst we can use SOLR to get the linked-to records,
     //       we shouldn't use SOLR to get our own information, as
     //       this would mean that DRAFT requests fail (drafts NOT
     // 		 in SOLR index).
     $suggestions = array();
     $sxml = $registry_object->getSimpleXML();
     if ($sxml->registryObject) {
         $sxml = $sxml->registryObject;
     }
     // Identifier matches (if another object has the same identifier)
     //var_dump($sxml);
     $my_identifiers = array();
     if ($sxml->{strtolower($registry_object->class)}->identifier) {
         foreach ($sxml->{strtolower($registry_object->class)}->identifier as $identifier) {
             if ((string) $identifier != '') {
                 $my_identifiers[] = (string) $identifier;
             }
         }
     }
     if (count($my_identifiers) == 0) {
         return $suggestions;
     }
     $identifier_search_query = '';
     if (sizeof($my_identifiers) > 0) {
         $identifier_search_query = join('","', $my_identifiers);
         $identifier_search_query = '+identifier_value:("' . $identifier_search_query . '")';
     }
     // But exclude already related objects
     $my_relationships = array_map(function ($elt) {
         return $elt;
     }, $registry_object->getRelatedKeys());
     $my_relationships[] = $registry_object->key;
     $relationship_search_query = '';
     if (sizeof($my_relationships) > 0) {
         $relationship_search_query = implode('") -key:("', $my_relationships);
         $relationship_search_query = '-key:("' . $relationship_search_query . '")';
     }
     $query = $relationship_search_query;
     if ($identifier_search_query != '') {
         $query .= ' AND ' . $identifier_search_query;
     }
     $suggestions = $this->getSuggestionsBySolrQuery($query, $start, $rows);
     if (sizeof($suggestions) > 0) {
         $suggestions['values'] = $my_identifiers;
     }
     return $suggestions;
 }
 public function getSuggestedLinksForRegistryObject(_registry_object $registry_object, $start, $rows)
 {
     // First, get published records with the same identifier as us
     // Note: whilst we can use SOLR to get the linked-to records,
     //       we shouldn't use SOLR to get our own information, as
     //       this would mean that DRAFT requests fail (drafts NOT
     // 		 in SOLR index).
     $suggestions = array();
     $sxml = $registry_object->getSimpleXML();
     if ($sxml->registryObject) {
         $sxml = $sxml->registryObject;
     }
     // Subject matches
     $my_subjects = array();
     if ($sxml->{strtolower($registry_object->class)}->subject) {
         foreach ($sxml->{strtolower($registry_object->class)}->subject as $subject) {
             $my_subjects[] = (string) removeBadValue($subject);
         }
     }
     if (count($my_subjects) == 0) {
         return $suggestions;
     }
     if (sizeof($my_subjects) > 0) {
         $subject_search_query = join('" OR subject_value_resolved:"', $my_subjects);
         $subject_search_query = "(subject_value_resolved:\"" . $subject_search_query . "\")";
     }
     // But exclude already related objects
     $my_relationships = array_map(function ($elt) {
         return $elt;
     }, $registry_object->getRelatedKeys());
     $my_relationships[] = $registry_object->key;
     $relationship_search_query = '';
     if (sizeof($my_relationships) > 0) {
         $relationship_search_query = join('","', $my_relationships);
         $relationship_search_query = '-key:("' . $relationship_search_query . '")';
     }
     $query = $relationship_search_query;
     if ($subject_search_query != '') {
         $query .= ' AND ' . $subject_search_query;
     }
     $suggestions = $this->getSuggestionsBySolrQuery($query, $start, $rows);
     if (sizeof($suggestions) > 0) {
         $suggestions['values'] = $my_subjects;
     }
     return $suggestions;
 }