/** * @return string */ public function publishersFilter() { $applicationLocalized = CacheApplicationTool::buildLocalizedApplicationByIdentifier( MerckManualShowcase::mainApplicationIdentifier() ); if ( $applicationLocalized instanceof ApplicationLocalized ) { return $applicationLocalized->getPublishersFilter(); } else { return null; } }
/** * @see ezfSolrDocumentFieldBase::getData() * @return array */ public function getData() { $data = parent::getData(); $content = $this->ContentObjectAttribute->content(); /* @var $content array */ foreach ( array_merge( self::taxonomyAttribute(), array_keys($content) ) as $taxonomyIdentifier ) { $taxonomyValues = isset( $content[$taxonomyIdentifier] ) ? $content[$taxonomyIdentifier] : array(); $subattrSourceIdValues = array(); $subattrSourceIdFieldName = self::getCustomSubattributeFieldName( $taxonomyIdentifier, 'source_id'); foreach ( $taxonomyValues as $taxonomyValue ) { if( preg_match( '#^symptom_.*$#', $taxonomyValue ) ) { $sourceKey = $taxonomyValue; $subattrSourceIdValues[] = $sourceKey; // we need a few more things for the symptoms /* @type $node eZContentObjectTreeNode */ $contentObject = $this->ContentObjectAttribute->object(); $node = $contentObject->mainNode(); $clusters = NodeTool::getArticleClusters($node); foreach( $clusters as $cluster ) { ClusterTool::setCurrentCluster($cluster); $ini = eZINI::fetchFromFile('extension/'.$cluster.'/settings/site.ini'); $node->setCurrentLanguage( $ini->variable('RegionalSettings', 'ContentObjectLocale') ); $applicationLocalized = CacheApplicationTool::buildLocalizedApplicationByIdentifier( MerckManualShowcase::mainApplicationIdentifier() ); if ( !$applicationLocalized ) continue; $customSymptomAttributeKey = 'attr_custom_symptom_'.$cluster.'_s'; $labelTranslations = FacetFilteringTool::getTaxonomyTranslation( 'symptom' ); $label = $labelTranslations[$sourceKey]; $url = preg_replace( '#^[^/]+#', '', MerckManualFunctionCollection::getMerckManualNodeUrl( 'meck-manual-showcase', $node, $ini->variable('RegionalSettings', 'ContentObjectLocale') ) ); ClusterTool::resetCurrentCluster(); $customSymptomAttributeValueParts = array( mb_strtolower(mb_substr(StringTool::removeAccents( StringTool::CJK2Pinyin($label) ), 0, 1)), $label, $url ); $data[$customSymptomAttributeKey] = implode( '##', $customSymptomAttributeValueParts ); } } else if ( preg_match('#^222\.[0-9]+$#', $taxonomyValue ) ) { $sourceKey = $taxonomyValue; $subattrSourceIdValues[] = $sourceKey; /* @type $node eZContentObjectTreeNode */ /* @type $dataMap eZContentObjectAttribute[] */ $contentObject = $this->ContentObjectAttribute->object(); $node = $contentObject->mainNode(); $clusters = NodeTool::getArticleClusters($node); $customSymptomAttributeValueParts = array( $content['layer_natom'][0], $content['sub_layer_natom'][0], ); foreach( $clusters as $cluster ) { ClusterTool::setCurrentCluster($cluster); $customSymptomAttributeKey = 'attr_custom_layer_sublayer_natom_'.$cluster.'_s'; $data[$customSymptomAttributeKey] = implode( '##', $customSymptomAttributeValueParts ); ClusterTool::resetCurrentCluster(); } } else $subattrSourceIdValues[] = trim( $taxonomyValue ); } $data[$subattrSourceIdFieldName] = empty($subattrSourceIdValues) ? '' : $subattrSourceIdValues; } return $data; }
/** * @param array $params * @return array */ public static function rawSearch($params) { $localApplication = CacheApplicationTool::buildLocalizedApplicationByIdentifier(MerckManualShowcase::mainApplicationIdentifier()); $publishersFilters = $localApplication->getPublishersFilter(); if ( isset($params['fq']) && trim($params['fq']) != '' ) { $params['fq'] .= ' AND ' . $publishersFilters; } else { $params['fq'] = $publishersFilters; } return SolrTool::rawSearch($params); }
/** * @param eZSolrDoc[] $docList * @param eZContentObjectTreeNode $node * @param $publisherFolderRelations */ protected function processSpecificMerckManual(&$docList, $node, $dataMap, $publisherFolderRelations) { /* @var eZContentObjectAttribute[] $datamapDefault */ $datamapDefault = $dataMap; $taxonomiesAttribute = $datamapDefault['serialized_taxonomies']; $merckManualClusters = array(); foreach ( $publisherFolderRelations['clusters'] as $cluster => $applications ) foreach ( $applications as $application ) if( $application == MerckManualShowcase::mainApplicationIdentifier() ) $merckManualClusters[] = $cluster; if( $taxonomiesAttribute instanceof eZContentObjectAttribute && $taxonomiesAttribute->hasContent() ) { $taxonomies = $taxonomiesAttribute->content(); if( isset( $taxonomies['section']) ) { $sections = $taxonomies['section']; foreach( $docList as $languageCode => $doc ) { $datamap = $node->object()->fetchDataMap(false, $languageCode); if( !$datamap ) $datamap = $datamapDefault; $customSectionChaptersParts = array( $sections[0], $node->attribute( 'node_id' ), $datamap['headline']->content() ); foreach( $merckManualClusters as $cluster ) { $doc->addField('attr_custom_section_chapter_' . $cluster . '_s', implode('##', $customSectionChaptersParts)); } } $this->addValueToDoc( $docList, 'subattr_section___source_id____s', $sections, true, true ); } } elseif ( !($taxonomiesAttribute instanceof eZContentObjectAttribute) ) { eZLog::write( "Indexation : Article with nodeId {$node->NodeID} doesn't have serialized_taxonomies attribute", 'error.log' ); } }