$facet_mgr->add_facet(new AfsFacet('Organization', AfsFacetType::STRING_TYPE)); $facet_mgr->add_facet(new AfsFacet('date_parution', AfsFacetType::DATE_TYPE)); $facet_mgr->add_facet(new AfsFacet('geo', AfsFacetType::STRING_TYPE)); $facet_mgr->add_facet(new AfsFacet('media', AfsFacetType::STRING_TYPE)); $facet_mgr->add_facet(new AfsFacet('person', AfsFacetType::STRING_TYPE)); $facet_mgr->add_facet(new AfsFacet('period', AfsFacetType::DATE_TYPE, AfsFacetLayout::INTERVAL)); $facet_mgr->add_facet(new AfsFacet('source', AfsFacetType::STRING_TYPE)); $facet_mgr->add_facet(new AfsFacet('taxo_iptc', AfsFacetType::STRING_TYPE)); $facet_mgr->add_facet(new AfsFacet('theme', AfsFacetType::STRING_TYPE)); $facet_mgr->add_facet(new AfsFacet('type', AfsFacetType::STRING_TYPE)); $facet_mgr->add_facet(new AfsFacet('pays', AfsFacetType::STRING_TYPE)); $facet_mgr->add_facet(new AfsFacet('annotated_city', AfsFacetType::STRING_TYPE)); $facet_mgr->add_facet(new AfsFacet('buildingDate', AfsFacetType::DATE_TYPE, AfsFacetLayout::INTERVAL)); $facet_mgr->add_facet(new AfsFacet('date', AfsFacetType::DATE_TYPE)); $facet_mgr->add_facet(new AfsFacet('stationParRegion', AfsFacetType::STRING_TYPE)); $facet_mgr->add_facet(new AfsFacet('ticketPrice', AfsFacetType::INTEGER_TYPE, AfsFacetLayout::INTERVAL)); /** [Facets and Facet manager] */ // Query Manager /** [Query manager] */ $query_mgr = new AfsSearchQueryManager($connector, $config); $reply = $query_mgr->send($query); /** [Query manager] */ // Response Helper /** [Response helper] */ $helper = new AfsResponseHelper($reply, $query, $config); /** [Response helper] */ // Load and apply PHP templates /** [Twig template] */ $template = $twig->loadTemplate('meta_template.html'); echo $template->render($helper->format()); /** [Twig template] */
/** @brief Executes query. * @param $query [in] * @param $format [in] prefered result format. * @return Helper or array depending on chosen $format. */ public function execute($query = null, $format = AfsHelperFormat::HELPERS) { if (!is_null($query)) { if ($query instanceof AfsQuery) { $this->set_query($query); } else { $format = $query; } } $this->config->set_helper_format($format); $query_mgr = new AfsSearchQueryManager($this->connector, $this->config); $reply = $query_mgr->send($this->query); $helper = new AfsResponseHelper($reply, $this->query, $this->config); if (AfsHelperFormat::ARRAYS == $format) { return $helper->format(); } else { return $helper; } }