( ! ) Fatal error: Uncaught Solarium\Exception\HttpException: Solr HTTP error: Bad Request (400) in /var/www/modx/assets/snippets/solrsearch/vendor/solarium/solarium/library/Solarium/Core/Query/Result/Result.php on line 103
( ! ) Solarium\Exception\HttpException: Solr HTTP error: Bad Request (400) in /var/www/modx/assets/snippets/solrsearch/vendor/solarium/solarium/library/Solarium/Core/Query/Result/Result.php on line 103
Call Stack
#
Time
Memory
Function
Location
1
0.0001
364416
{main}( )
.../index.php:0
2
0.0008
393712
DocumentParser->executeParser( )
.../index.php:202
3
0.0077
682536
DocumentParser->prepareResponse( )
.../document.parser.class.inc.php:2865
4
0.0084
690952
DocumentParser->parseDocumentSource( )
.../document.parser.class.inc.php:2971
5
0.0127
796936
DocumentParser->evalSnippets( )
.../document.parser.class.inc.php:2719
6
0.0777
1081968
DocumentParser->_get_snip_result( )
.../document.parser.class.inc.php:2034
7
0.0777
1082720
DocumentParser->evalSnippet( )
.../document.parser.class.inc.php:2120
8
0.0780
1160040
eval( '// set the base path
$path = $modx->config['base_path'] . 'assets/snippets/solrsearch';
$sePath = $modx->config['base_path'] . 'assets/snippets/searchengine';
$lPath = $modx->config['base_path'] . 'assets/snippets/PortalCore/leasing';
$title_tag = "Maskiner til salg | Find dit næste maskine hos ";
if (!class_exists('SEconfig')) require $sePath . '/config.class.php';
if (!class_exists('imgSEO')) require $sePath . '/img_seo.class.php';
if (!class_exists('Leasing')) require $lPath . '/leasing.class.php';
require_once $path . '/conf/init.php';
require_once $path . '/DictionaryManager.php';
require_once $path . '/UrlManager.php';
require_once $path . '/SearchClient.php';
require_once $path . '/CategoryTree.php';
if (!isset($modx->config['solr_lang'])) $modx->config['solr_lang'] = solrLang::getObject();
$openx_banners = array(
'mega_banner' => array('zoneid' => '221', 'width' => '930', 'height' => '90', 'target' => 'default'),
'mega_banner_mobil' => array('zoneid' => '228', 'width' => '600', 'height' => '225', 'target' => 'mobile'),
);
// Advertisement array
$advertisements = array();
foreach ($openx_banners as $openx_name => $openx_info) {
$openx_status = @file_get_contents('https://adserver.fbg.dk/www/delivery/check.php?zoneid='.$openx_info['zoneid']);
$advertisements[$openx_name] = (is_numeric($openx_status) && $openx_status == 1 ? $modx->runSnippet('2019_openx_zone_single_res', $openx_info) : '');
}
$advertisements['sky_banner'] = $modx->getChunk('2019_skybanner_machine_search');
//BrugtPro feature array
$brugtpro = array(
'solr_top' => $modx->getChunk('2020_searchengine_solr_brugtpro_top'),
);
$loader = new Twig_Loader_Filesystem($path . '/templates');
$twig = new Twig_Environment($loader);
$twig->addExtension(new Twig_Extensions_Extension_Text());
$defaultPageSize = 24;
$urlManager = new UrlManager();
$searchClient = new SearchClient($defaultPageSize);
$dictionaryManager = new DictionaryManager();
$requestArray = $urlManager->getSearchConfig();
$searchResults = $searchClient->getSearchResults($requestArray);
// Return error page when fatal fault in SOLR
if ($searchResults === false) return $twig->render(
'2019.error-page.html',
array(
'advertisements' => $advertisements,
'siteUrl' => $modx->config['site_url'],
'language' => $modx->config['solr_lang'],
)
);
$currentPage = $urlManager->getFilterValue('p') ? $urlManager->getFilterValue('p') : 1;
$categoryTree = new CategoryTree($urlManager->getCategoryNodeId());
$pageSize = isset($requestArray['rows']) && is_numeric($requestArray['rows']) && $requestArray['rows'] > 0 ? $requestArray['rows'] : $defaultPageSize;
$categoryTree->setFacets($searchResults['facets']['treenode_id']);
//sort facets by titles
foreach (array('country_id', 'location_id', 'brand_id') as $facetKey) {
$facetTitles = array();
foreach ($searchResults['facets'][$facetKey] as $id => $count) {
$title = $dictionaryManager->getPhrase($facetKey, $id);
if ($title != '') $facetTitles[$id] = $title;
}
asort($facetTitles);
$facetArray = array();
foreach ($facetTitles as $id => $title) {
$facetArray[$id] = $searchResults['facets'][$facetKey][$id];
}
$searchResults['facets'][$facetKey] = $facetArray;
}
// ad age options
$adAgeOptions = array(
"*" => $modx->config['solr_lang']->getString('238'),
"NOW-1DAY" => $modx->config['solr_lang']->getString('239'),
"NOW-2DAYS" => $modx->config['solr_lang']->getString('240'),
"NOW-3DAYS" => $modx->config['solr_lang']->getString('241'),
"NOW-7DAYS" => $modx->config['solr_lang']->getString('242'),
"NOW-14DAYS" => $modx->config['solr_lang']->getString('243'),
"NOW-21DAYS" => $modx->config['solr_lang']->getString('244'),
"NOW-28DAYS" => $modx->config['solr_lang']->getString('245'),
"NOW-3MONTHS" => $modx->config['solr_lang']->getString('246'),
"NOW-6MONTHS" => $modx->config['solr_lang']->getString('247'),
"NOW-1YEAR" => $modx->config['solr_lang']->getString('248'),
);
// Set page title
$currentPath = $categoryTree->getPath();
$currentCategory = strtolower(end($currentPath));
$categoryTitle = false;
if (count($currentPath) > 0) {
switch ($currentCategory) {
case '1e8ae347-0cba-4690-aa94-e2684c779158':
$categoryTitle = 'Nye og brugte landbrugsmaskiner og landbrugsudstyr';
break;
case '20a3b1dd-c7ec-4164-b8ce-d91824a0057a':
$categoryTitle = 'Nye og brugte have- og parkmaskiner';
break;
case 'f268d600-625f-4650-ab91-b3cfef4c9f0d':
$categoryTitle = 'Nye og brugte entreprenørmaskiner og entreprenørudstyr';
break;
case '63d5843d-e6bc-4663-8d33-19cc6f1039e4':
$categoryTitle = 'Nye og brugte maskiner og udstyr inden for transport';
break;
case '2da0e3c6-3447-4f77-b36e-c5e957cb6141':
$categoryTitle = 'Nye og brugte maskiner inden for skovbrug';
break;
case '2435ca07-f635-4263-a14f-b1d24960f7d7':
$categoryTitle = 'Nye og brugte maskiner og udstyr inden for industri';
break;
default:
$categoryTitle = 'Brugte ' . strtolower($dictionaryManager->getPhrase('tree_node_id', $currentCategory)) . ' til salg | Nye ' . strtolower($dictionaryManager->getPhrase('tree_node_id', $currentCategory)) . ' til salg | Køb og salg af ' . strtolower($dictionaryManager->getPhrase('tree_node_id', $currentCategory)) .'';
break;
}
if ($urlManager->onAuction()) $categoryTitle .= ' på auktion';
}
elseif ($urlManager->isLatest() || $urlManager->isFeatured() || $urlManager->isStolen() || $urlManager->onAuction()) {
if ($urlManager->isLatest()) {
$categoryTitle = 'Senest oprettede brugte maskiner og udstyr';
}
elseif ($urlManager->isFeatured()) {
$categoryTitle = 'Fremhævede brugte maskiner og udstyr';
}
elseif ($urlManager->isStolen()) {
$categoryTitle = 'Stjålne brugte maskiner og udstyr';
}
elseif ($urlManager->onAuction()) {
$categoryTitle = 'Brugte maskiner og udstyr på auktion';
}
elseif ($urlManager->isScrapyard()) {
$categoryTitle = 'Ophuggede maskiner og udstyr';
}
}
$_curr_cat = strtolower($dictionaryManager->getPhrase('tree_node_id', $currentCategory));
$metaDescription = 'Køb og salg af nye og brugte ' . strtolower($dictionaryManager->getPhrase('tree_node_id', $currentCategory)) . '. Stort udvalg af nye og brugte ' . strtolower($dictionaryManager->getPhrase('tree_node_id', $currentCategory)) . '. Find nye og brugte ' . strtolower($dictionaryManager->getPhrase('tree_node_id', $currentCategory)) . ' på Maskinbladet';
$metaKeywords = $_curr_cat . ', nye ' . $_curr_cat . ', brugte ' . $_curr_cat . ', køb ' . $_curr_cat . ', sælg ' . $_curr_cat . ', find ' . $_curr_cat;
$title_tag = ($categoryTitle ? $categoryTitle.' | Søgeresultat ' : $title_tag); //ændret
$modx->setPlaceholder('meta_description', $metaDescription);
$modx->setPlaceholder('meta_keywords', $metaKeywords);
// SEO override - title and meta_description
//if (count($currentPath) > 0) {
$meta_title = seo_text::getTitle($currentCategory);
$meta_descr = seo_text::getDescription($currentCategory);
if ($meta_title !== false) $title_tag = $meta_title;
if ($meta_descr !== false) $modx->setPlaceholder('meta_description', $meta_descr);
//}
// Landing page for known brands
if (isset($_GET['brand_id']) && trim($_GET['brand_id']) != '' && isset($_GET['info']) && trim($_GET['info']) == 1) {
$brand_name = $dictionaryManager->getPhrase('brand_id', $_GET['brand_id']);
$brand_clean = str_replace(array('-', '_', '/', ' '), '', $brand_name);
$chunkPrepared = $modx->getChunk( strtolower($brand_clean) );
$chunkDefault = $modx->parseChunk('default_brand', array('brand' => ucfirst($brand_name)), '[+', '+]');
$title_tag = 'Info om ' . $brand_name . ' | Brugte ' . $brand_name . ' maskiner til salg ';
$modx->setPlaceholder('meta_keywords', $brand_name.', traktorer, brugte ' . $brand_name . ' maskiner, nye ' . $brand_name . ' maskiner, Maskinbladet');
$modx->setPlaceholder('meta_description', 'Information om ' . $brand_name . ' | Find nye eller brugte '.$brand_name.' maskiner til salg her på Maskinbladet.dk');
$modx->setPlaceholder('Brandname', $brand_name);
$modx->setPlaceholder('preparedBrand', $chunkPrepared);
$modx->setPlaceholder('defaultBrand', $chunkDefault);
}
function changeRequestURI(array $param) {
$pu = parse_url($_SERVER["REQUEST_URI"]);
if (isset($pu['query'])) { parse_str($pu['query'], $ps); } else { $ps = array(); }
return $pu['path'] . '?' . http_build_query(array_merge($ps, $param));
}
if ($currentPage > 1) {
$seo_prev_url = $modx->config['site_url'] . ltrim(changeRequestURI(array('p' => ($currentPage - 1))), '/');
$modx->setPlaceholder('seo_pager_prev', '');
}
if ($currentPage < ceil($searchResults['numFound'] / $pageSize)) {
$seo_next_url = $modx->config['site_url'] . ltrim(changeRequestURI(array('p' => ($currentPage + 1))), '/');
$modx->setPlaceholder('seo_pager_next', '');
}
$adStatus = 'online';
if (isset($_GET['adStatus']) && trim($_GET['adStatus']) != '') {
$adStatus = trim($_GET['adStatus']);
}
if (isset($_GET['searchName']) && trim($_GET['searchName']) != '') {
$searchName = $_GET['searchName'];
}
//////////JONAS SEO OPTIMAZING
if (isset($searchResults) && empty($searchResults['data'])) {
http_response_code(404);
}
//////////JONAS SEO OPTIMAZING
$seo_text = seo_text::getText($currentCategory);
//$title_tag = seo_text::urlbasedTitle($title_tag); //Check for custom titles based on url
$modx->setPlaceholder('title_tag', $title_tag);
//print_r($_GET);
return $twig->render(
'2019.search-page.html',
array(
'searchResults' => $searchResults,
'currentPage' => $currentPage,
'pageSize' => $pageSize,
'urlManager' => $urlManager,
'searchClient' => $searchClient,
'categoryTree' => $categoryTree,
'dictionaryManager' => $dictionaryManager,
'adAgeOptions' => $adAgeOptions,
'adStatus' => $adStatus,
'advertisements' => $advertisements,
'brugtpro' => $brugtpro,
'siteUrl' => $modx->config['site_url'],
'imgSEO' => new imgSEO(),
'seconfig' => new SEconfig(),
'language' => $modx->config['solr_lang'],
'leasing' => new Leasing(),
'leasing_stats_url' => $modx->makeURL(114),
'seo_text' => $seo_text,
'headingLevel' => ($seo_text['top'] != '') ? 'h3' : 'h1',
)
);' )