/** * @return bool */ public function jsonBuildResult() { $this->initChannelInformations(); $editorsChoice = $this->getEditorsChoice(); $this->resultHandler->parseRequestParams(true); $solrResult = $this->resultHandler->contentResultMain(); if ($this->getCustomParameter('IncludeChildrenInSearch')) { $this->resultHandler->getChildArticles($solrResult); } $facets = array(); $this->pushResult('num_found', (int)$solrResult['response']['numFound']); $this->pushResult('with_feed', $this->resultHandler->withFeed); if ( $this->resultHandler->withFacets ) { foreach ( $this->facets as $facet) { /* @var $facet FacetBase */ $f = array( 'uxtype' => $facet->uxtype, 'list' => ( $facet->isFiltered() ) ? $this->resultHandler->filteredFacetResult( $facet ) : $facet->facetResult( $solrResult ) ); // JsonBuildResult is called again with facet with no result unchecked (state change via $this->facets) if ( $facet->needsRefresh ) return $this->jsonBuildResult(); $facets[$facet->key] = $f; } $this->pushResult('facets', $facets); } if (!empty($editorsChoice)) { $editorsChoice = $this->resultHandler->articleResult($editorsChoice, $facets); $this->pushResult('editors_choice' , $this->getEditorsChoiceView($editorsChoice)); } $solrReturn = $this->resultHandler->articleResult($solrResult, $facets); $this->pushResult('articles', $this->setVariableAndGetTpl($solrReturn)); if ( isset($solrReturn['all_specialities_informations'] ) ) { $allSpecialitiesInformations = $solrReturn['all_specialities_informations']; unset( $solrReturn['all_specialities_informations'] ); if (SolrSafeOperatorHelper::featureIsActive('SpecialityPopin') && SolrSafeOperatorHelper::feature('SpecialityPopin', 'CustomGroupsEnabled')) { $flatSpecialitiesList = array(); foreach($allSpecialitiesInformations['all_specialities'] as $value) { foreach($value as $name => $data) { $name = StringTool::trim($name); $flatSpecialitiesList[$name] = $data; } } $customGroups = SolrSafeOperatorHelper::feature('SpecialityPopin', 'Groups'); $allSpecialities = array(); foreach ($customGroups as $name => $specialities) { $name = StringTool::trim($name); $allSpecialities[$name] = array(); foreach($specialities as $speciality) { $speciality = StringTool::trim($speciality); if (isset($flatSpecialitiesList[$speciality])) { $allSpecialities[$name][$speciality] = $flatSpecialitiesList[$speciality]; unset($flatSpecialitiesList[$speciality]); } } } $allSpecialitiesInformations['all_specialities'] = $allSpecialities; } foreach ($allSpecialitiesInformations as $templateVariable => $templateValue) $this->tpl()->setVariable($templateVariable, $templateValue); $this->pushResult('all_specialities', $this->tpl()->fetch('design:'.$this->templateRootDirectory().'/content_service/specialities_list.tpl')); } $t3Facet = array(); if ( isset($solrReturn['t3_facet_informations'] ) ) { if ( count($solrReturn['t3_facet_informations']) > 0 ) { $t3FacetInformations = $solrReturn['t3_facet_informations']; foreach ($t3FacetInformations as $templateVariable => $templateValue) $this->tpl()->setVariable($templateVariable, $templateValue); $t3Facet[$t3FacetInformations['t3_key']] = $this->tpl()->fetch('design:'.$this->templateRootDirectory().'/content_service/t3_facet_list.tpl'); } unset( $solrReturn['t3_facet_informations'] ); } $this->pushResult('t3_facets', $t3Facet); foreach ( $solrReturn as $resultVariable => $resultValue ) $this->pushResult($resultVariable, $resultValue); return true; }