if ($resultSearch->count()) {
    header('Content-type: application/json');
    $proccessSearch = null;
    if ($toSearch == "video") {
        requireVideo();
        $proccessSearch = new ProccessVideoSearch($resultSearch);
    } elseif ($toSearch == "paper") {
        requirePaper();
        $proccessSearch = new ProccessPublicationSearch($resultSearch);
    } elseif ($toSearch == 'analysis') {
        requireAnalysis();
        $proccessSearch = new ProccessAnalysisSearch($resultSearch);
    }
    $json = new JsonResponse();
    $json->response(true, $proccessSearch->getResultsFound(), TRUE);
    $json->addValue("searchType", $toSearch);
    print_r($json->serialize());
} else {
    $json = new JsonResponse();
    print_r($json->response(false, "Nenhum registro encontrado")->addValue("searchType", $toSearch)->serialize());
}
?>
<?
function requirePublications(){
    require_once '../core/Publication/Publication.php';
    require_once '../core/generics/SubArea.php';
    require_once '../core/SearchEngine/ProccessPublicationSearch.php';
}

function requireVideo(){
    require_once '../core/Video/Video.php';
<?php

require_once 'XmlCharts/XmlChart.php';
require_once 'XmlCharts/MultiSerie/XmlMultiSeries.php';
require_once 'XmlCharts/MultiSerie/XmlMultiSerieColumn.php';
require_once 'Configs/MultiSeriesConfig.php';
require_once 'Configs/MultiSeriesColumnConfig.php';
require_once 'core/Cotation/CotacoesRefactor/HtmlLib.php';
$allCots = HtmlLib::cotacoes();
$config = new MultiSeriesColumnConfig();
$bmf = $allCots->get("BMF");
$config->config($bmf);
$config->config($allCots->get("NY"));
$config->config($allCots->get("London"));
$config->configColors();
$xml = "arq_multicolumn.xml";
$xmlResponse = $config->getChartXml()->buildXml("core/Charts/xml/" . $xml);
$jsonResponse = new JsonResponse();
print_r($jsonResponse->addValue("xml", str_replace("\"", "'", $xmlResponse))->serialize());