187 if (!isset($this->settings[
'results'])) {
192 $this->availableResultsNumbers = array_filter(GeneralUtility::intExplode(
',', $this->settings[
'blind'][
'numberOfResults']));
195 if (isset($this->availableResultsNumbers[0])) {
196 $this->defaultResultNumber = $this->availableResultsNumbers[0];
202 if (is_array($this->settings[
'defaultOptions'])) {
206 if ((
$searchData[
'languageUid'] ??
'') ===
'current') {
207 $searchData[
'languageUid'] = GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect(
'language',
'id', 0);
211 $this->indexerConfig = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(
'indexed_search');
212 $this->enableMetaphoneSearch = (bool)$this->indexerConfig[
'enableMetaphoneSearch'];
232 $this->searchRootPageIdList = (int)
$GLOBALS[
'TSFE']->config[
'rootLine'][0][
'uid'];
241 if ($this->settings[
'rootPidList']) {
242 $this->searchRootPageIdList = implode(
',', GeneralUtility::intExplode(
',', $this->settings[
'rootPidList']));
244 $this->searchRepository = GeneralUtility::makeInstance(\
TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::class);
245 $this->searchRepository->initialize($this->settings,
$searchData, $this->externalParsers, $this->searchRootPageIdList);
248 if ($hookObj = $this->
hookRequest(
'initialize_postProc')) {
249 $hookObj->initialize_postProc();
265 if ($freeIndexUid == -2) {
266 $freeIndexUid = $this->settings[
'defaultFreeIndexUidList'];
276 $indexCfgs = GeneralUtility::intExplode(
',', $freeIndexUid);
278 foreach ($indexCfgs as $freeIndexUid) {
280 $tstamp1 = GeneralUtility::milliseconds();
282 $resultData = $hookObj->getResultRows($this->searchWords, $freeIndexUid);
284 $resultData = $this->searchRepository->doSearch($this->searchWords, $freeIndexUid);
287 $tstamp2 = GeneralUtility::milliseconds();
288 if ($hookObj = $this->
hookRequest(
'getDisplayResults')) {
289 $resultsets[$freeIndexUid] = $hookObj->getDisplayResults($this->searchWords, $resultData, $freeIndexUid);
291 $resultsets[$freeIndexUid] = $this->
getDisplayResults($this->searchWords, $resultData, $freeIndexUid);
293 $tstamp3 = GeneralUtility::milliseconds();
295 if (count($indexCfgs) > 1) {
296 if ($freeIndexUid > 0) {
297 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
298 ->getQueryBuilderForTable(
'index_config');
299 $queryBuilder->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));
300 $indexCfgRec = $queryBuilder
302 ->from(
'index_config')
304 $queryBuilder->expr()->eq(
306 $queryBuilder->createNamedParameter($freeIndexUid, \PDO::PARAM_INT)
311 $categoryTitle = $indexCfgRec[
'title'];
315 $resultsets[$freeIndexUid][
'categoryTitle'] = $categoryTitle;
320 $this->view->assign(
'resultsets', $resultsets);
322 $this->view->assign(
'searchWords', $this->searchWords);
340 'count' => $resultData[
'count'],
346 $this->firstRow = $resultData[
'firstRow'];
348 $result[
'rows'] = $this->
compileResultRows($resultData[
'resultRows'], $freeIndexUid);
351 if ($resultData[
'count']) {
353 if ($this->searchData[
'group'] ===
'sections' && $freeIndexUid <= 0) {
354 $resultSectionsCount = count($this->resultSections);
355 $result[
'sectionText'] = sprintf(
LocalizationUtility::translate(
'result.' . ($resultSectionsCount > 1 ?
'inNsections' :
'inNsection'),
'IndexedSearch'), $resultSectionsCount);
360 if (strpos($this->searchData[
'sections'],
'rl') === 0) {
364 if ($hookObj = $this->
hookRequest(
'getDisplayResults_postProc')) {
365 $result = $hookObj->getDisplayResults_postProc($result);
381 $finalResultRows = [];
385 foreach ($resultRows as $row) {
386 $id = md5($row[
'phash_grouping']);
387 if (is_array($newResultRows[$id])) {
389 if (!$newResultRows[$id][
'show_resume'] && $row[
'show_resume']) {
391 $subrows = $newResultRows[$id][
'_sub'];
392 unset($newResultRows[$id][
'_sub']);
393 $subrows[] = $newResultRows[$id];
395 $newResultRows[$id] = $row;
396 $newResultRows[$id][
'_sub'] = $subrows;
398 $newResultRows[$id][
'_sub'][] = $row;
401 $newResultRows[$id] = $row;
404 $resultRows = $newResultRows;
405 $this->resultSections = [];
406 if ($freeIndexUid <= 0 && $this->searchData[
'group'] ===
'sections') {
407 $rl2flag = strpos($this->searchData[
'sections'],
'rl') === 0;
409 foreach ($resultRows as $row) {
410 $id = $row[
'rl0'] .
'-' . $row[
'rl1'] . ($rl2flag ?
'-' . $row[
'rl2'] :
'');
411 $sections[$id][] = $row;
413 $this->resultSections = [];
414 foreach ($sections as $id => $resultRows) {
415 $rlParts = explode(
'-', $id);
417 $theId = $rlParts[2];
418 $theRLid =
'rl2_' . $rlParts[2];
419 } elseif ($rlParts[1]) {
420 $theId = $rlParts[1];
421 $theRLid =
'rl1_' . $rlParts[1];
423 $theId = $rlParts[0];
427 $sectionName = ltrim($sectionName,
'/');
428 if (!trim($sectionName)) {
431 $onclick =
'document.forms[\'tx_indexedsearch\'][\'tx_indexedsearch_pi2[search][_sections]\'].value=' . GeneralUtility::quoteJSvalue($theRLid) .
';document.forms[\'tx_indexedsearch\'].submit();return false;';
432 $sectionTitleLinked =
'<a href="#" onclick="' . htmlspecialchars($onclick) .
'">' . $sectionName .
':</a>';
434 $resultRowsCount = count($resultRows);
435 $this->resultSections[$id] = [$sectionName, $resultRowsCount];
437 $finalResultRows[] = [
438 'isSectionHeader' =>
true,
439 'numResultRows' => $resultRowsCount,
441 'sectionTitle' => $sectionTitleLinked
444 foreach ($resultRows as $row) {
450 foreach ($resultRows as $row) {
454 return $finalResultRows;
468 $resultData[
'headerOnly'] = $headerOnly;
469 $resultData[
'CSSsuffix'] = $specRowConf[
'CSSsuffix'] ?
'-' . $specRowConf[
'CSSsuffix'] :
'';
471 $dat = unserialize($row[
'cHashParams']);
472 $pp = explode(
'-', $dat[
'key']);
473 if ($pp[0] != $pp[1]) {
479 $title = $resultData[
'item_title'] . $resultData[
'titleaddition'];
480 $title = GeneralUtility::fixed_lgd_cs($title, $this->settings[
'results.'][
'titleCropAfter'], $this->settings[
'results.'][
'titleCropSignifier']);
482 if ($row[
'item_type']) {
483 if ($row[
'show_resume']) {
485 $targetAttribute =
'';
486 if (
$GLOBALS[
'TSFE']->config[
'config'][
'fileTarget']) {
487 $targetAttribute =
' target="' . htmlspecialchars(
$GLOBALS[
'TSFE']->config[
'config'][
'fileTarget']) .
'"';
489 $title =
'<a href="' . htmlspecialchars($row[
'data_filename']) .
'"' . $targetAttribute .
'>' . htmlspecialchars($title) .
'</a>';
493 unset($copiedRow[
'cHashParams']);
496 $this->
linkPage($row[
'page_id'], $copiedRow)
502 $markUpSwParams = [];
503 if ($this->settings[
'forwardSearchWordsInResultLink'][
'_typoScriptNodeValue']) {
504 if ($this->settings[
'forwardSearchWordsInResultLink'][
'no_cache']) {
505 $markUpSwParams = [
'no_cache' => 1];
507 foreach ($this->searchWords as $d) {
508 $markUpSwParams[
'sword_list'][] = $d[
'sword'];
513 $this->
linkPage($row[
'data_page_id'], $row, $markUpSwParams)
516 $resultData[
'title'] = $title;
517 $resultData[
'icon'] = $this->
makeItemTypeIcon($row[
'item_type'],
'', $specRowConf);
521 (
bool)!($this->searchData[
'extResume'] && !$headerOnly),
522 $this->settings[
'results.'][
'summaryCropAfter']
525 $resultData[
'size'] = GeneralUtility::formatSize($row[
'item_size']);
526 $resultData[
'created'] = $row[
'item_crdate'];
527 $resultData[
'modified'] = $row[
'item_mtime'];
528 $pI = parse_url($row[
'data_filename']);
530 $targetAttribute =
'';
531 if (
$GLOBALS[
'TSFE']->config[
'config'][
'fileTarget']) {
532 $targetAttribute =
' target="' . htmlspecialchars(
$GLOBALS[
'TSFE']->config[
'config'][
'fileTarget']) .
'"';
534 $resultData[
'pathTitle'] = $row[
'data_filename'];
535 $resultData[
'pathUri'] = $row[
'data_filename'];
536 $resultData[
'path'] =
'<a href="' . htmlspecialchars($row[
'data_filename']) .
'"' . $targetAttribute .
'>' . htmlspecialchars($row[
'data_filename']) .
'</a>';
538 $pathId = $row[
'data_page_id'] ?: $row[
'page_id'];
539 $pathMP = $row[
'data_page_id'] ? $row[
'data_page_mp'] :
'';
544 'cHashParams' => $row[
'cHashParams'],
545 'data_page_type' => $row[
'data_page_type'],
546 'data_page_mp' => $pathMP,
547 'sys_language_uid' => $row[
'sys_language_uid'],
548 'static_page_arguments' => $row[
'static_page_arguments']
552 $resultData[
'pathTitle'] = $pathStr;
553 $resultData[
'pathUri'] = $pathLinkData[
'uri'];
557 if (is_array($this->requiredFrontendUsergroups[$pathId]) && !empty($this->requiredFrontendUsergroups[$pathId])) {
558 $lockedIcon = GeneralUtility::getFileAbsFileName(
'EXT:indexed_search/Resources/Public/Icons/FileTypes/locked.gif');
560 $resultData[
'access'] =
'<img src="' . htmlspecialchars($lockedIcon) .
'"'
561 .
' width="12" height="15" vspace="5" title="'
562 . sprintf(
LocalizationUtility::translate(
'result.memberGroups',
'IndexedSearch'), implode(
',', array_unique($this->requiredFrontendUsergroups[$pathId])))
568 if (is_array($row[
'_sub'])) {
569 $resultData[
'subresults'] = [];
572 foreach ($row[
'_sub'] as $subRow) {
592 $pathId = $row[
'data_page_id'] ?: $row[
'page_id'];
593 $pathMP = $row[
'data_page_id'] ? $row[
'data_page_mp'] :
'';
594 $specConf = $this->settings[
'specialConfiguration'][
'0'];
596 $rl = GeneralUtility::makeInstance(RootlineUtility::class, $pathId, $pathMP)->get();
597 foreach ($rl as $dat) {
598 if (is_array($this->settings[
'specialConfiguration'][$dat[
'uid']])) {
599 $specConf = $this->settings[
'specialConfiguration'][$dat[
'uid']];
600 $specConf[
'_pid'] = $dat[
'uid'];
604 }
catch (RootLineException $e) {
619 switch ((
string)$this->searchData[
'sortOrder']) {
625 if ($this->firstRow[
'order_val2']) {
627 $base = $row[
'order_val1'] * 256;
629 $freqNumber = $row[
'order_val2'] / $this->firstRow[
'order_val2'] * pow(2, 12);
631 return ceil(log($total) / log(32767) * 100) .
'%';
637 return ceil(log($total) / log($max) * 100) .
'%';
639 return $GLOBALS[
'TSFE']->cObj->calcAge(
$GLOBALS[
'EXEC_TIME'] - $row[
'item_crdate'], 0);
641 return $GLOBALS[
'TSFE']->cObj->calcAge(
$GLOBALS[
'EXEC_TIME'] - $row[
'item_mtime'], 0);
657 if ((
string)$row[
'item_type'] ===
'0') {
659 if (is_array($this->settings[
'flagRendering'])) {
661 $cObj = GeneralUtility::makeInstance(\
TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
662 $cObj->setCurrentVal($row[
'sys_language_uid']);
663 $typoScriptArray = $this->typoScriptService->convertPlainArrayToTypoScriptArray($this->settings[
'flagRendering']);
664 $output = $cObj->cObjGetSingle($this->settings[
'flagRendering'][
'_typoScriptNodeValue'], $typoScriptArray);
682 if ($imageType ===
'0' && $specRowConf[
'_pid'] && is_array($specRowConf[
'pageIcon']) && !is_array($this->settings[
'iconRendering'])) {
683 $imageType .=
':' . $specRowConf[
'_pid'];
685 if (!isset($this->iconFileNameCache[$imageType])) {
686 $this->iconFileNameCache[$imageType] =
'';
688 if (is_array($this->settings[
'iconRendering'])) {
690 $cObj = GeneralUtility::makeInstance(\
TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
691 $cObj->setCurrentVal($imageType);
692 $typoScriptArray = $this->typoScriptService->convertPlainArrayToTypoScriptArray($this->settings[
'iconRendering']);
693 $this->iconFileNameCache[$imageType] = $cObj->cObjGetSingle($this->settings[
'iconRendering'][
'_typoScriptNodeValue'], $typoScriptArray);
697 if ($imageType ===
'0' || strpos($imageType,
'0:') === 0) {
698 if (is_array($specRowConf[
'pageIcon'])) {
699 $this->iconFileNameCache[$imageType] =
$GLOBALS[
'TSFE']->cObj->cObjGetSingle(
'IMAGE', $specRowConf[
'pageIcon']);
701 $icon =
'EXT:indexed_search/Resources/Public/Icons/FileTypes/pages.gif';
703 } elseif ($this->externalParsers[$imageType]) {
704 $icon = $this->externalParsers[$imageType]->getIcon($imageType);
707 $fullPath = GeneralUtility::getFileAbsFileName($icon);
709 $imageInfo = GeneralUtility::makeInstance(ImageInfo::class, $fullPath);
711 $this->iconFileNameCache[$imageType] = $imageInfo->getWidth()
712 ?
'<img src="' . $iconPath
713 .
'" width="' . $imageInfo->getWidth()
714 .
'" height="' . $imageInfo->getHeight()
715 .
'" title="' . htmlspecialchars($alt) .
'" alt="" />'
721 return $this->iconFileNameCache[$imageType];
735 if ($row[
'show_resume']) {
738 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(
'index_fulltext');
739 $ftdrow = $queryBuilder
741 ->from(
'index_fulltext')
743 $queryBuilder->expr()->eq(
745 $queryBuilder->createNamedParameter($row[
'phash'], \PDO::PARAM_INT)
750 if ($ftdrow !==
false) {
752 $content = preg_replace(
'/(http:\\/\\/[^ ]{' . $this->settings[
'results.'][
'hrefInSummaryCropAfter'] .
'})([^ ]+)/i',
'$1...', $ftdrow[
'fulltextdata']);
756 if (!trim($markedSW)) {
757 $outputStr = GeneralUtility::fixed_lgd_cs($row[
'item_description'], $length, $this->settings[
'results.'][
'summaryCropSignifier']);
758 $outputStr = htmlspecialchars($outputStr);
775 $htmlParser = GeneralUtility::makeInstance(HtmlParser::class);
777 $str = str_replace(
' ',
' ', $htmlParser->bidir_htmlspecialchars($str, -1));
778 $str = preg_replace(
'/\\s\\s+/',
' ', $str);
781 foreach ($this->searchWords as $d) {
782 $swForReg[] = preg_quote($d[
'sword'],
'/');
784 $regExString =
'(' . implode(
'|', $swForReg) .
')';
786 $parts = preg_split(
'/' . $regExString .
'/i',
' ' . $str .
' ', 20000, PREG_SPLIT_DELIM_CAPTURE);
788 $summaryMax = $this->settings[
'results.'][
'markupSW_summaryMax'];
789 $postPreLgd = $this->settings[
'results.'][
'markupSW_postPreLgd'];
790 $postPreLgd_offset = $this->settings[
'results.'][
'markupSW_postPreLgd_offset'];
791 $divider = $this->settings[
'results.'][
'markupSW_divider'];
792 $occurencies = (count($parts) - 1) / 2;
800 foreach ($parts as $k => $strP) {
803 $strLen = mb_strlen($parts[$k],
'utf-8');
808 if ($strLen > $postPreLgd) {
809 $output[$k] = $divider . preg_replace(
'/^[^[:space:]]+[[:space:]]/',
'', GeneralUtility::fixed_lgd_cs($parts[$k], -($postPreLgd - $postPreLgd_offset)));
811 } elseif ($summaryLgd > $summaryMax || !isset($parts[$k + 1])) {
813 if ($strLen > $postPreLgd) {
814 $output[$k] = preg_replace(
'/[[:space:]][^[:space:]]+$/',
'', GeneralUtility::fixed_lgd_cs(
816 $postPreLgd - $postPreLgd_offset
820 if ($strLen > $postPreLgd * 2) {
821 $output[$k] = preg_replace(
'/[[:space:]][^[:space:]]+$/',
'', GeneralUtility::fixed_lgd_cs(
823 $postPreLgd - $postPreLgd_offset
824 )) . $divider . preg_replace(
'/^[^[:space:]]+[[:space:]]/',
'', GeneralUtility::fixed_lgd_cs($parts[$k], -($postPreLgd - $postPreLgd_offset)));
827 $summaryLgd += mb_strlen(
$output[$k],
'utf-8');
831 if ($summaryLgd > $summaryMax) {
835 $summaryLgd += mb_strlen($strP,
'utf-8');
836 $output[$k] =
'<strong class="tx-indexedsearch-redMarkup">' . htmlspecialchars($parts[$k]) .
'</strong>';
860 $ipMask = isset($this->indexerConfig[
'trackIpInStatistic']) ? (int)$this->indexerConfig[
'trackIpInStatistic'] : 2;
862 }
catch (\Exception $e) {
865 'searchstring' => $searchWord,
866 'searchoptions' => serialize([$searchParams,
$searchWords, $pt]),
867 'feuser_id' => (int)
$GLOBALS[
'TSFE']->fe_user->user[
'uid'],
869 'cookie' =>
$GLOBALS[
'TSFE']->fe_user->id,
873 'hits' => (
int)$count,
877 $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable(
'index_search_stat');
883 $newId = $connection->lastInsertId(
'index_stat_search');
885 $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable(
'index_stat_word');
888 'word' => $val[
'sword'],
889 'index_stat_search_id' => $newId,
895 $connection->insert(
'index_stat_word', $insertFields);
927 $sWordArray = $hookObj->getSearchWords_splitSWords(
$searchWords, $defaultOperator);
930 if ($this->searchData[
'searchType'] == 20) {
940 $operatorTranslateTable = [
951 if (is_array($swordArray)) {
968 $newSearchWords = [];
970 $lexerObjectClassName =
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'indexed_search'][
'lexer'] ?: \TYPO3\CMS\IndexedSearch\Lexer::class;
971 $this->lexerObj = GeneralUtility::makeInstance($lexerObjectClassName);
975 if (strpos($wordDef[
'sword'],
' ') ===
false) {
977 $res = $this->lexerObj->split2Words($wordDef[
'sword']);
979 foreach ($res as $word) {
980 $newSearchWords[] = [
982 'oper' => $wordDef[
'oper']
986 $newSearchWords[] = $wordDef;
989 return $newSearchWords;
1002 $this->view->assign(
'sword', $this->
getSword());
1028 $types = [0, 1, 2, 3, 10, 20];
1029 $blindSettings = $this->settings[
'blind'];
1030 if (!$blindSettings[
'searchType']) {
1031 foreach ($types as $typeNum) {
1036 if (!$this->enableMetaphoneSearch) {
1037 unset($allOptions[10]);
1052 $blindSettings = $this->settings[
'blind'];
1053 if (!$blindSettings[
'defaultOperand']) {
1072 $mediaTypes = [-1, 0, -2];
1073 $blindSettings = $this->settings[
'blind'];
1074 if (!$blindSettings[
'mediaType']) {
1075 foreach ($mediaTypes as $mediaType) {
1079 $additionalMedia = trim($this->settings[
'mediaList']);
1080 if ($additionalMedia !==
'') {
1081 $additionalMedia = GeneralUtility::trimExplode(
',', $additionalMedia,
true);
1083 $additionalMedia = [];
1085 foreach ($this->externalParsers as $extension => $obj) {
1087 if (!empty($additionalMedia) && !in_array($extension, $additionalMedia)) {
1090 if ($name = $obj->searchTypeMediaTitle($extension)) {
1092 $allOptions[$extension] = $translatedName ?: $name;
1111 $blindSettings = $this->settings[
'blind'];
1112 if (!$blindSettings[
'languageUid']) {
1114 $site = GeneralUtility::makeInstance(SiteFinder::class)
1115 ->getSiteByPageId(
$GLOBALS[
'TSFE']->
id);
1117 $languages = $site->getLanguages();
1118 foreach ($languages as $language) {
1119 $allOptions[$language->getLanguageId()] = $language->getNavigationTitle() ?? $language->getTitle();
1121 }
catch (SiteNotFoundException $e) {
1146 $sections = [0, -1, -2, -3];
1147 $blindSettings = $this->settings[
'blind'];
1148 if (!$blindSettings[
'sections']) {
1149 foreach ($sections as $section) {
1155 if ($this->settings[
'displayLevel1Sections']) {
1156 $firstLevelMenu = $this->
getMenuOfPages($this->searchRootPageIdList);
1159 foreach ($firstLevelMenu as $firstLevelKey => $menuItem) {
1160 if (!$menuItem[
'nav_hide']) {
1161 $allOptions[
'rl1_' . $menuItem[
'uid']] = trim($labelLevel1 .
' ' . $menuItem[
'title']);
1162 if ($this->settings[
'displayLevel2Sections']) {
1164 foreach ($secondLevelMenu as $secondLevelKey => $menuItemLevel2) {
1165 if (!$menuItemLevel2[
'nav_hide']) {
1166 $allOptions[
'rl2_' . $menuItemLevel2[
'uid']] = trim($labelLevel2 .
' ' . $menuItemLevel2[
'title']);
1168 unset($secondLevelMenu[$secondLevelKey]);
1174 unset($firstLevelMenu[$firstLevelKey]);
1196 $blindSettings = $this->settings[
'blind'];
1197 if (!$blindSettings[
'indexingConfigurations']) {
1199 if ($this->settings[
'defaultFreeIndexUidList']) {
1200 $uidList = GeneralUtility::intExplode(
',', $this->settings[
'defaultFreeIndexUidList']);
1201 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
1202 ->getQueryBuilderForTable(
'index_config');
1203 $queryBuilder->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));
1204 $result = $queryBuilder
1205 ->select(
'uid',
'title')
1206 ->from(
'index_config')
1208 $queryBuilder->expr()->in(
1210 $queryBuilder->createNamedParameter($uidList, Connection::PARAM_INT_ARRAY)
1215 while ($row = $result->fetch()) {
1216 $allOptions[$row[
'uid']] = $row[
'title'];
1239 $sortOrders = [
'rank_flag',
'rank_freq',
'rank_first',
'rank_count',
'mtime',
'title',
'crdate'];
1240 $blindSettings = $this->settings[
'blind'];
1241 if (!$blindSettings[
'sortOrder']) {
1242 foreach ($sortOrders as $order) {
1259 $blindSettings = $this->settings[
'blind'];
1260 if (!$blindSettings[
'groupBy']) {
1279 $blindSettings = $this->settings[
'blind'];
1280 if (!$blindSettings[
'descending']) {
1299 if (count($this->availableResultsNumbers) > 1) {
1300 $allOptions = array_combine($this->availableResultsNumbers, $this->availableResultsNumbers);
1316 if (is_array($blindOptions)) {
1317 foreach ($blindOptions as $key => $val) {
1319 unset($allOptions[$key]);
1334 protected function linkPage($pageUid, $row = [], $markUpSwParams = [])
1336 $pageLanguage = GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect(
'language',
'contentId', 0);
1338 $urlParameters = (array)unserialize($row[
'cHashParams']);
1339 if ($row[
'static_page_arguments'] !==
null) {
1340 $urlParameters = array_replace_recursive($urlParameters, json_decode($row[
'static_page_arguments'],
true));
1343 if ($row[
'data_page_mp']) {
1344 $urlParameters[
'MP'] = $row[
'data_page_mp'];
1346 if (($pageLanguage === 0 && $row[
'sys_language_uid'] > 0) || $pageLanguage > 0) {
1347 $urlParameters[
'L'] = (int)$row[
'sys_language_uid'];
1350 $urlParameters = array_merge($urlParameters, $markUpSwParams);
1353 if (!is_array($this->domainRecords[$pageUid])) {
1368 $pageRepository = GeneralUtility::makeInstance(PageRepository::class);
1369 if ($this->settings[
'displayLevelxAllTypes']) {
1370 return $pageRepository->getMenuForPages([$pageUid]);
1372 return $pageRepository->getMenu($pageUid);
1384 $identStr = $id .
'|' . $pathMP;
1385 if (!isset($this->pathCache[$identStr])) {
1386 $this->requiredFrontendUsergroups[$id] = [];
1387 $this->domainRecords[$id] = [];
1389 $rl = GeneralUtility::makeInstance(RootlineUtility::class, $id, $pathMP)->get();
1391 $pageCount = count($rl);
1393 $excludeDoktypesFromPath = GeneralUtility::trimExplode(
1395 $this->settings[
'results'][
'pathExcludeDoktypes'] ??
'',
1398 $breadcrumbWrap = $this->settings[
'breadcrumbWrap'] ??
'/';
1399 $breadcrumbWraps = GeneralUtility::makeInstance(TypoScriptService::class)
1400 ->explodeConfigurationForOptionSplit([
'wrap' => $breadcrumbWrap], $pageCount);
1401 foreach ($rl as $k => $v) {
1402 if (in_array($v[
'doktype'], $excludeDoktypesFromPath,
false)) {
1406 if ($v[
'fe_group'] && ($v[
'uid'] == $id || $v[
'extendToSubpages'])) {
1407 $this->requiredFrontendUsergroups[$id][] = $v[
'fe_group'];
1410 if ($this->settings[
'detectDomainRecords']) {
1413 $this->domainRecords[$id][] = $domainName;
1415 $path = $domainName . $path;
1420 if ($v[
'uid'] ==
$GLOBALS[
'TSFE']->config[
'rootLine'][0][
'uid']) {
1421 array_pop($breadcrumbWraps);
1424 $path =
$GLOBALS[
'TSFE']->cObj->wrap(htmlspecialchars($v[
'title']), array_pop($breadcrumbWraps)[
'wrap']) . $path;
1427 }
catch (RootLineException $e) {
1430 $this->pathCache[$identStr] = $path;
1432 return $this->pathCache[$identStr];
1445 $domain = GeneralUtility::makeInstance(SiteFinder::class)
1446 ->getSiteByRootPageId($id)
1450 $pseudoSiteFinder = GeneralUtility::makeInstance(PseudoSiteFinder::class);
1452 $domain = trim((
string)$pseudoSiteFinder->getSiteByPageId($id)->getBase(),
'/');
1453 }
catch (SiteNotFoundException $e) {
1467 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'indexed_search'][
'external_parsers'] ?? [] as $extension => $className) {
1468 $this->externalParsers[$extension] = GeneralUtility::makeInstance($className);
1470 if (!$this->externalParsers[$extension]->softInit($extension)) {
1471 unset($this->externalParsers[$extension]);
1485 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'indexed_search'][
'pi1_hooks'][$functionName]) {
1486 $hookObj = GeneralUtility::makeInstance(
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'indexed_search'][
'pi1_hooks'][$functionName]);
1487 if (method_exists($hookObj, $functionName)) {
1488 $hookObj->pObj = $this;
1503 return is_object($this->externalParsers[$item_type]) && $this->externalParsers[$item_type]->isMultiplePageExtension($item_type);
1523 'allSearchTypes' => $allSearchTypes,
1524 'allDefaultOperands' => $allDefaultOperands,
1525 'showTypeSearch' => !empty($allSearchTypes) || !empty($allDefaultOperands),
1526 'allMediaTypes' => $allMediaTypes,
1527 'allLanguageUids' => $allLanguageUids,
1528 'showMediaAndLanguageSearch' => !empty($allMediaTypes) || !empty($allLanguageUids),
1531 'allSortOrders' => $allSortOrders,
1532 'allSortDescendings' => $allSortDescendings,
1533 'showSortOrders' => !empty($allSortOrders) || !empty($allSortDescendings),
1544 if (!is_array($this->settings[
'results.'])) {
1545 $this->settings[
'results.'] = [];
1547 $typoScriptArray = $this->typoScriptService->convertPlainArrayToTypoScriptArray($this->settings[
'results']);
1550 $GLOBALS[
'TSFE']->cObj->stdWrap($typoScriptArray[
'summaryCropAfter'], $typoScriptArray[
'summaryCropAfter.']),
1555 $this->settings[
'results.'][
'summaryCropSignifier'] =
$GLOBALS[
'TSFE']->cObj->stdWrap($typoScriptArray[
'summaryCropSignifier'], $typoScriptArray[
'summaryCropSignifier.']);
1557 $GLOBALS[
'TSFE']->cObj->stdWrap($typoScriptArray[
'titleCropAfter'], $typoScriptArray[
'titleCropAfter.']),
1562 $this->settings[
'results.'][
'titleCropSignifier'] =
$GLOBALS[
'TSFE']->cObj->stdWrap($typoScriptArray[
'titleCropSignifier'], $typoScriptArray[
'titleCropSignifier.']);
1564 $GLOBALS[
'TSFE']->cObj->stdWrap($typoScriptArray[
'markupSW_summaryMax'], $typoScriptArray[
'markupSW_summaryMax.']),
1570 $GLOBALS[
'TSFE']->cObj->stdWrap($typoScriptArray[
'markupSW_postPreLgd'], $typoScriptArray[
'markupSW_postPreLgd.']),
1576 $GLOBALS[
'TSFE']->cObj->stdWrap($typoScriptArray[
'markupSW_postPreLgd_offset'], $typoScriptArray[
'markupSW_postPreLgd_offset.']),
1581 $this->settings[
'results.'][
'markupSW_divider'] =
$GLOBALS[
'TSFE']->cObj->stdWrap($typoScriptArray[
'markupSW_divider'], $typoScriptArray[
'markupSW_divider.']);
1583 $GLOBALS[
'TSFE']->cObj->stdWrap($typoScriptArray[
'hrefInSummaryCropAfter'], $typoScriptArray[
'hrefInSummaryCropAfter.']),
1588 $this->settings[
'results.'][
'hrefInSummaryCropSignifier'] =
$GLOBALS[
'TSFE']->cObj->stdWrap($typoScriptArray[
'hrefInSummaryCropSignifier'], $typoScriptArray[
'hrefInSummaryCropSignifier.']);
1599 $numberOfResults = (int)$numberOfResults;
1601 return in_array($numberOfResults, $this->availableResultsNumbers) ?
1614 protected function preparePageLink(
int $pageUid, array $row, array $urlParameters): array
1617 $uri = $this->controllerContext->getUriBuilder()
1618 ->setTargetPageUid($pageUid)
1619 ->setTargetPageType($row[
'data_page_type'])
1620 ->setUseCacheHash(
true)
1621 ->setArguments($urlParameters)
1625 if (!empty($this->domainRecords[$pageUid])) {
1626 $scheme = GeneralUtility::getIndpEnv(
'TYPO3_SSL') ?
'https://' :
'http://';
1627 $firstDomain = reset($this->domainRecords[$pageUid]);
1628 $uri = $scheme . $firstDomain . $uri;
1629 $target = $this->settings[
'detectDomainRecords.'][
'target'];
1632 return [
'uri' => $uri,
'target' => $target];
1645 'href' => $linkData[
'uri']
1647 if (!empty($linkData[
'target'])) {
1648 $attributes[
'target'] = $linkData[
'target'];
1652 GeneralUtility::implodeAttributes($attributes,
true),
1653 htmlspecialchars($linkText, ENT_QUOTES | ENT_HTML5)
1663 $this->sword = (string)
$sword;