/** * Returns the ElasticSearch type name from which this document came from. * * If this is a new document, this function returns null * * @return string|nulll */ public function type() { if ($this->_result) { return $this->_result->getType(); } return null; }
/** * @param Result $object * @return mixed */ private function getObjectDetail(Result $object) { $objectType = $object->getType(); $source = $object->getSource(); switch ($objectType) { case 'issue': $data['name'] = empty($source['title']) ? $this->generateIssueUrl($object) : $source['title']; $data['route'] = $this->generateIssueUrl($object); break; case 'journal': $data['name'] = $source['title']; $data['route'] = $this->generateJournalUrl($object); break; case 'articles': $data['name'] = $source['title']; $data['route'] = $this->generateArticleUrl($object); break; case 'subject': $data['name'] = $source['subject']; $filterParam['filter'] = ['subject' => $object->getId()]; $data['route'] = $this->router->generate('ojs_site_explore_index', $filterParam, true); break; case 'publisher': $data['name'] = $source['name']; $data['route'] = $this->router->generate('ojs_publisher_page', ['slug' => $source['slug']], true); break; case 'user': $data['name'] = $source['firstName'] . ' ' . $source['lastName']; $data['route'] = $this->router->generate('ojs_user_profile', ['slug' => $source['username']], true); break; case 'author': $data['name'] = $source['firstName'] . ' ' . $source['lastName']; $data['route'] = $this->generateAuthorUrl($object); break; case 'page': $data['name'] = $source['title']; $data['route'] = '#'; break; case 'citation': $data['name'] = $source['raw']; $data['route'] = '#'; break; default: $data['name'] = $objectType; $data['route'] = '#'; break; } return $data; }