/**
  * Constructor of this class
  */
 public function __construct()
 {
     // get extension configuration array
     $this->extConf = tx_kesearch_helper::getExtConf();
     $this->extConfPremium = tx_kesearch_helper::getExtConfPremium();
     $this->registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
     // fetch the list of the default indexers which come with ke_search
     foreach ($GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['type']['config']['items'] as $indexerType) {
         $this->defaultIndexerTypes[] = $indexerType[1];
     }
 }
 /**
  * Constructor of this class
  */
 public function __construct()
 {
     // get extension configuration array
     $this->extConf = tx_kesearch_helper::getExtConf();
     $this->extConfPremium = tx_kesearch_helper::getExtConfPremium();
     if (TYPO3_VERSION_INTEGER >= 7000000) {
         $this->registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
     } else {
         if (TYPO3_VERSION_INTEGER >= 6002000) {
             $this->registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_Registry');
         } else {
             $this->registry = t3lib_div::makeInstance('t3lib_Registry');
         }
     }
     // fetch the list of the default indexers which come with ke_search
     // load TCA definition first (only necessary in TYPO3 below 6.1)
     if (TYPO3_VERSION_INTEGER < 6001000) {
         t3lib_div::loadTCA('tx_kesearch_indexerconfig');
     }
     foreach ($GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['type']['config']['items'] as $indexerType) {
         $this->defaultIndexerTypes[] = $indexerType[1];
     }
 }
 /**
  * creates a index entry for a given file
  * @param string $file
  * @param string $content
  */
 public function storeToIndex($file, $content)
 {
     $tags = '';
     tx_kesearch_helper::makeTags($tags, array('file'));
     // get data from FAL
     if ($file instanceof \TYPO3\CMS\Core\Resource\File) {
         $metadata = $file->_getMetaData();
         $orig_uid = $file->getUid();
     } else {
         $metadata = false;
         $orig_uid = 0;
     }
     $indexRecordValues = array('storagepid' => $this->indexerConfig['storagepid'], 'title' => $this->fileInfo->getName(), 'type' => 'file:' . $this->fileInfo->getExtension(), 'targetpid' => 1, 'tags' => $tags, 'params' => '', 'abstract' => '', 'language_uid' => -1, 'starttime' => 0, 'endtime' => 0, 'fe_group' => 0, 'debug' => false);
     $additionalFields = array('sortdate' => $this->fileInfo->getModificationTime(), 'orig_uid' => $orig_uid, 'orig_pid' => 0, 'directory' => $this->fileInfo->getRelativePath(), 'hash' => $this->getUniqueHashForFile());
     // add additional content if FAL is used
     if ($this->pObj->indexerConfig['fal_storage'] > 0) {
         // index meta data from FAL: title, description, alternative
         if ($metadata['title']) {
             $indexRecordValues['content'] = $metadata['title'] . "\n" . $indexRecordValues['content'];
         }
         if ($metadata['description']) {
             $indexRecordValues['abstract'] = $metadata['description'];
             $content = $metadata['description'] . "\n" . $content;
         }
         if ($metadata['alternative']) {
             $content .= "\n" . $metadata['alternative'];
         }
         // make tags from assigned categories
         $categories = tx_kesearch_helper::getCategories($metadata['uid'], 'sys_file_metadata');
         tx_kesearch_helper::makeTags($indexRecordValues['tags'], $categories['title_list']);
         // assign categories as generic tags (eg. "syscat123")
         tx_kesearch_helper::makeSystemCategoryTags($indexRecordValues['tags'], $metadata['uid'], 'sys_file_metadata');
     }
     // hook for custom modifications of the indexed data, e. g. the tags
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFileIndexEntry'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFileIndexEntry'] as $_classRef) {
             $_procObj =& GeneralUtility::getUserObj($_classRef);
             $_procObj->modifyFileIndexEntry($file, $content, $additionalFields, $indexRecordValues, $this);
         }
     }
     // store record in index table
     $this->pObj->storeInIndex($indexRecordValues['storagepid'], $indexRecordValues['title'], $indexRecordValues['type'], $indexRecordValues['targetpid'], $content, $indexRecordValues['tags'], $indexRecordValues['params'], $indexRecordValues['abstract'], $indexRecordValues['language_uid'], $indexRecordValues['starttime'], $indexRecordValues['endtime'], $indexRecordValues['fe_group'], $indexRecordValues['debug'], $additionalFields);
 }
 /**
  * get result link configuration
  * It can devide between the result types (file, page, content)
  *
  * @return array configuration for typolink
  */
 public function getResultLinkConfiguration()
 {
     return tx_kesearch_helper::getResultLinkConfiguration($this->row, $this->conf['resultLinkTarget'], $this->conf['resultLinkTargetFiles']);
 }
 /**
  * @param $eventUid
  * @param $tags
  */
 private function buildCategoryTags($eventUid, &$tags)
 {
     $table = 'tx_cal_event_category_mm, tx_cal_category';
     $fields = 'title';
     $where = 'tx_cal_category.uid = tx_cal_event_category_mm.uid_foreign';
     $where .= ' AND tx_cal_event_category_mm.uid_local = ' . intval($eventUid);
     // add enablefields
     $where .= TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tx_cal_category');
     $where .= TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tx_cal_category');
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where);
     $resCount = $GLOBALS['TYPO3_DB']->sql_num_rows($res, 'res count: ');
     if ($resCount) {
         while ($catRecord = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             // build tags for connected categories
             tx_kesearch_helper::makeTags($tags, array($catRecord['title']));
         }
     }
 }
 /**
  *
  * Store the file content and additional information to the index
  *
  * @param $fileObject file reference object or file object
  * @param string $content file text content
  * @param tx_kesearch_indexer_types_file $fileIndexerObject
  * @param string $feGroups comma list of groups to assign
  * @param array $ttContentRow tt_content element the file was assigned to
  * @author Christian Bülter <*****@*****.**>
  * @since 25.09.13
  */
 public function storeFileContentToIndex($fileObject, $content, $fileIndexerObject, $feGroups, $tags, $ttContentRow)
 {
     // get metadata
     if ($fileObject instanceof TYPO3\CMS\Core\Resource\FileReference) {
         $orig_uid = $fileObject->getOriginalFile()->getUid();
         $metadata = $fileObject->getOriginalFile()->_getMetaData();
     } else {
         $orig_uid = $fileObject->getUid();
         $metadata = $fileObject->_getMetaData();
     }
     // assign categories as tags (as cleartext, eg. "colorblue")
     $categories = tx_kesearch_helper::getCategories($metadata['uid'], 'sys_file_metadata');
     tx_kesearch_helper::makeTags($tags, $categories['title_list']);
     // assign categories as generic tags (eg. "syscat123")
     tx_kesearch_helper::makeSystemCategoryTags($tags, $metadata['uid'], 'sys_file_metadata');
     if ($metadata['title']) {
         $content = $metadata['title'] . "\n" . $content;
     }
     if ($metadata['description']) {
         $abstract = $metadata['description'];
         $content = $metadata['description'] . "\n" . $content;
     }
     if ($metadata['alternative']) {
         $content .= "\n" . $metadata['alternative'];
     }
     $title = $fileIndexerObject->fileInfo->getName();
     $storagePid = $this->indexerConfig['storagepid'];
     $type = 'file:' . $fileObject->getExtension();
     $additionalFields = array('sortdate' => $fileIndexerObject->fileInfo->getModificationTime(), 'orig_uid' => $orig_uid, 'orig_pid' => 0, 'directory' => $fileIndexerObject->fileInfo->getRelativePath(), 'hash' => $fileIndexerObject->getUniqueHashForFile());
     //hook for custom modifications of the indexed data, e. g. the tags
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFileIndexEntryFromContentIndexer'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFileIndexEntryFromContentIndexer'] as $_classRef) {
             $_procObj =& \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
             $_procObj->modifyFileIndexEntryFromContentIndexer($fileObject, $content, $fileIndexerObject, $feGroups, $ttContentRow, $storagePid, $title, $tags, $abstract, $additionalFields);
         }
     }
     // Store record in index table:
     // Add usergroup restrictions of the page and the
     // content element to the index data.
     // Add time restrictions to the index data.
     $this->pObj->storeInIndex($storagePid, $title, $type, $ttContentRow['pid'], $content, $tags, '', $abstract, $ttContentRow['sys_language_uid'], $ttContentRow['starttime'], $ttContentRow['endtime'], $feGroups, false, $additionalFields);
 }
 /**
  * renders the preview image of a file result
  *
  * @param array $row result row
  * @author Christian Bülter <*****@*****.**>
  * @since 17.10.14
  * @return string
  */
 public function renderFilePreview($row)
 {
     list($type, $filetype) = explode(':', $row['type']);
     if (in_array($filetype, $this->fileTypesWithPreviewPossible)) {
         $imageConf = $this->conf['previewImage.'];
         // if index record is of type "file" and contains an orig_uid, this is the reference
         // to a FAL record. Otherwise we use the path directly.
         if ($row['orig_uid'] && ($fileObject = tx_kesearch_helper::getFile($row['orig_uid']))) {
             $metadata = $fileObject->_getMetaData();
             $imageConf['file'] = $fileObject->getPublicUrl();
             $imageConf['altText'] = $metadata['alternative'];
         } else {
             $imageConf['file'] = $row['directory'] . rawurlencode($row['title']);
         }
         return $this->renderPreviewImage($imageConf);
     }
 }
 /**
  * creates tags from category titles
  * 
  * @author Christian Bülter <*****@*****.**>
  * @since 26.06.13 15:49
  * @param string $tags
  * @param array $categoryData
  * @return string
  */
 private function addTagsFromNewsCategories($tags, $categoryData)
 {
     tx_kesearch_helper::makeTags($tags, $categoryData['title_list']);
     return $tags;
 }
Пример #9
0
 /**
  * Initializes flexform, conf vars and some more
  *
  * @return void
  */
 public function init()
 {
     // get some helper functions
     $this->div = GeneralUtility::makeInstance('tx_kesearch_lib_div', $this);
     // set start of query timer
     if (!$GLOBALS['TSFE']->register['ke_search_queryStartTime']) {
         $GLOBALS['TSFE']->register['ke_search_queryStartTime'] = GeneralUtility::milliseconds();
     }
     // make settings from flexform available in general configuration ($this->conf)
     $this->moveFlexFormDataToConf();
     // in pi2 (the list plugin) fetch the configuration from pi1 (the search
     // box plugin) since all the configuration is done there
     if (!empty($this->conf['loadFlexformsFromOtherCE'])) {
         $data = $this->pi_getRecord('tt_content', intval($this->conf['loadFlexformsFromOtherCE']));
         $this->cObj->data = $data;
         $this->moveFlexFormDataToConf();
     }
     // clean piVars
     $this->piVars = $this->div->cleanPiVars($this->piVars);
     // get preselected filter from rootline
     $this->getFilterPreselect();
     // add stdWrap properties to each config value
     foreach ($this->conf as $key => $value) {
         $this->conf[$key] = $this->cObj->stdWrap($value, $this->conf[$key . '.']);
     }
     // set some default values (this part have to be after stdWrap!!!)
     if (!$this->conf['resultPage']) {
         $this->conf['resultPage'] = $GLOBALS['TSFE']->id;
     }
     if (!isset($this->piVars['page'])) {
         $this->piVars['page'] = 1;
     }
     if (!empty($this->conf['additionalPathForTypeIcons'])) {
         $this->conf['additionalPathForTypeIcons'] = rtrim($this->conf['additionalPathForTypeIcons'], '/') . '/';
     }
     // hook: modifyFlexFormData
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFlexFormData'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFlexFormData'] as $_classRef) {
             $_procObj =& GeneralUtility::getUserObj($_classRef);
             $_procObj->modifyFlexFormData($this->conf, $this->cObj, $this->piVars);
         }
     }
     // prepare database object
     $this->db = GeneralUtility::makeInstance('tx_kesearch_db', $this);
     // set startingPoints
     $this->startingPoints = $this->div->getStartingPoint();
     // get filter class
     $this->filters = GeneralUtility::makeInstance('tx_kesearch_filters');
     // get extension configuration array
     $this->extConf = tx_kesearch_helper::getExtConf();
     $this->extConfPremium = tx_kesearch_helper::getExtConfPremium();
     // initialize filters
     $this->filters->initialize($this);
     // init templating (marker based or fluid)
     $this->initTemplate();
     // get first startingpoint
     $this->firstStartingPoint = $this->div->getFirstStartingPoint($this->startingPoints);
     // build words searchphrase
     $searchPhrase = GeneralUtility::makeInstance('tx_kesearch_lib_searchphrase');
     $searchPhrase->initialize($this);
     $searchWordInformation = $searchPhrase->buildSearchPhrase();
     // Hook: modifySearchWords
     if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifySearchWords'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifySearchWords'] as $classRef) {
             $hookObj = GeneralUtility::getUserObj($classRef);
             if (method_exists($hookObj, 'modifySearchWords')) {
                 $hookObj->modifySearchWords($searchWordInformation, $this);
             }
         }
     }
     // set searchword and tag information
     $this->sword = $searchWordInformation['sword'];
     $this->swords = $searchWordInformation['swords'];
     $this->wordsAgainst = $searchWordInformation['wordsAgainst'];
     $this->tagsAgainst = $searchWordInformation['tagsAgainst'];
     $this->scoreAgainst = $searchWordInformation['scoreAgainst'];
     $this->isEmptySearch = $this->isEmptySearch();
     // Since sorting for "relevance" in most cases ist the most useful option and
     // this sorting option is not available until a searchword is given, make it
     // the default sorting after a searchword has been given.
     // Set default sorting to "relevance" if the following conditions are true:
     // * sorting by user is allowed
     // * sorting for "relevance" is allowed (internal: "score")
     // * user did not select his own sorting yet
     // * a searchword is given
     $isInList = GeneralUtility::inList($this->conf['sortByVisitor'], 'score');
     if ($this->conf['showSortInFrontend'] && $isInList && !$this->piVars['sortByField'] && $this->sword) {
         $this->piVars['sortByField'] = 'score';
         $this->piVars['sortByDir'] = 'desc';
     }
     // after the searchword is removed, sorting for "score" is not possible
     // anymore. So remove this sorting here and put it back to default.
     if (!$this->sword && $this->piVars['sortByField'] == 'score') {
         unset($this->piVars['sortByField']);
         unset($this->piVars['sortByDir']);
     }
     // chooseBestIndex is only needed for MySQL-Search. Not for Sphinx
     if (!$this->extConfPremium['enableSphinxSearch']) {
         // precount results to find the best index
         $this->db->chooseBestIndex($this->wordsAgainst, $this->tagsAgainst);
     }
     // perform search at this point already if we need to calculate what
     // filters to display.
     if ($this->conf['checkFilterCondition'] != 'none') {
         $this->db->getSearchResults();
     }
     // add cssTag to header if set
     $cssFile = $GLOBALS['TSFE']->tmpl->getFileName($this->conf['cssFile']);
     if (!empty($cssFile)) {
         $GLOBALS['TSFE']->getPageRenderer()->addCssFile($cssFile);
     }
 }
 /**
  * renders a link to a search result
  *
  * @param array $resultRow
  * @param string $targetDefault
  * @param string $targetFiles
  * @author Christian Bülter <*****@*****.**>
  * @since 31.10.14
  * @return array
  */
 public static function getResultLinkConfiguration($resultRow, $targetDefault = '', $targetFiles = '')
 {
     $linkconf = array();
     list($type) = explode(':', $resultRow['type']);
     switch ($type) {
         case 'file':
             // render a link for files
             // if we use FAL, we can use the API
             if ($resultRow['orig_uid']) {
                 /* @var $fileRepository TYPO3\CMS\Core\Resource\FileRepository */
                 $fileRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository');
                 $fileObject = $fileRepository->findByUid($resultRow['orig_uid']);
                 $linkconf['parameter'] = $fileObject->getPublicUrl();
             } else {
                 $linkconf['parameter'] = $resultRow['directory'] . rawurlencode($resultRow['title']);
             }
             $linkconf['fileTarget'] = $targetFiles;
             break;
         case 'external':
             // render a link for external results (provided by eg. ke_search_premium or tt_news)
             $linkconf['parameter'] = $resultRow['params'];
             $linkconf['useCacheHash'] = false;
             $linkconf['additionalParams'] = '';
             $extConfPremium = tx_kesearch_helper::getExtConfPremium();
             $linkconf['extTarget'] = $extConfPremium['apiExternalResultTarget'] ? $extConfPremium['apiExternalResultTarget'] : '_blank';
             break;
         default:
             // render a link for page targets
             // if params are filled, add them to the link generation process
             if (!empty($resultRow['params'])) {
                 $linkconf['additionalParams'] = $resultRow['params'];
             }
             $linkconf['parameter'] = $resultRow['targetpid'];
             $linkconf['useCacheHash'] = true;
             $linkconf['target'] = $targetDefault;
             break;
     }
     return $linkconf;
 }
 /**
  * get content of current page and save data to db
  * @param $uid page-UID that has to be indexed
  */
 function getPageContent($uid)
 {
     // get content elements for this page
     $fields = '*';
     $table = 'tt_content';
     $where = 'pid = ' . intval($uid);
     $where .= ' AND (' . $this->whereClauseForCType . ')';
     // add condition for not indexing gridelement columns with colPos = -2 (= invalid)
     if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('gridelements')) {
         $where .= ' AND colPos <> -2 ';
     }
     // don't index elements which are hidden or deleted, but do index
     // those with time restrictons, the time restrictens will be
     // copied to the index
     //$where .= t3lib_BEfunc::BEenableFields($table);
     $where .= ' AND hidden=0';
     $where .= TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table);
     // Get access restrictions for this page
     $pageAccessRestrictions = $this->getInheritedAccessRestrictions($uid);
     $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fields, $table, $where);
     if (count($rows)) {
         foreach ($rows as $row) {
             // skip this content element if the page itself is hidden or a
             // parent page with "extendToSubpages" set is hidden
             if ($pageAccessRestrictions['hidden']) {
                 continue;
             }
             if ($row['sys_language_uid'] > 0 && $this->cachedPageRecords[$row['sys_language_uid']][$row['pid']]['hidden']) {
                 continue;
             }
             // combine group access restrictons from page(s) and content element
             $feGroups = $this->getCombinedFeGroupsForContentElement($pageAccessRestrictions['fe_group'], $row['fe_group']);
             // skip this content element if either the page or the content
             // element is set to "hide at login"
             // and the other one has a frontend group attached to it
             if ($feGroups == DONOTINDEX) {
                 continue;
             }
             // get content for this content element
             $content = '';
             // get tags from page
             $tags = $this->pageRecords[$uid]['tags'];
             // assign categories as tags (as cleartext, eg. "colorblue")
             $categories = tx_kesearch_helper::getCategories($row['uid'], $table);
             tx_kesearch_helper::makeTags($tags, $categories['title_list']);
             // assign categories as generic tags (eg. "syscat123")
             tx_kesearch_helper::makeSystemCategoryTags($tags, $row['uid'], $table);
             // index header
             // add header only if not set to "hidden"
             if ($row['header_layout'] != 100) {
                 $content .= strip_tags($row['header']) . "\n";
             }
             // index content of this content element and find attached or linked files.
             // Attached files are saved as file references, the RTE links directly to
             // a file, thus we get file objects.
             if (in_array($row['CType'], $this->fileCTypes)) {
                 $fileObjects = $this->findAttachedFiles($row);
             } else {
                 $fileObjects = $this->findLinkedFilesInRte($row);
                 $content .= $this->getContentFromContentElement($row) . "\n";
             }
             // index the files fond
             $this->indexFiles($fileObjects, $row, $pageAccessRestrictions['fe_group]'], $tags) . "\n";
             // Combine starttime and endtime from page, page language overlay
             // and content element.
             // TODO:
             // If current content element is a localized content
             // element, fetch startdate and enddate from original conent
             // element as the localized content element cannot have it's
             // own start- end enddate
             $starttime = $pageAccessRestrictions['starttime'];
             if ($this->cachedPageRecords[$row['sys_language_uid']][$row['pid']]['starttime'] > $starttime) {
                 $starttime = $this->cachedPageRecords[$row['sys_language_uid']][$row['pid']]['starttime'];
             }
             if ($row['starttime'] > $starttime) {
                 $starttime = $row['starttime'];
             }
             $endtime = $pageAccessRestrictions['endtime'];
             if ($endtime == 0 || $this->cachedPageRecords[$row['sys_language_uid']][$row['pid']]['endtime'] && $this->cachedPageRecords[$row['sys_language_uid']][$row['pid']]['endtime'] < $endtime) {
                 $endtime = $this->cachedPageRecords[$row['sys_language_uid']][$row['pid']]['endtime'];
             }
             if ($endtime == 0 || $row['endtime'] && $row['endtime'] < $endtime) {
                 $endtime = $row['endtime'];
             }
             // prepare additionalFields (to be added via hook)
             $additionalFields = array();
             // make it possible to modify the indexerConfig via hook
             $indexerConfig = $this->indexerConfig;
             // hook for custom modifications of the indexed data, e. g. the tags
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyContentIndexEntry'])) {
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyContentIndexEntry'] as $_classRef) {
                     $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
                     $_procObj->modifyContentIndexEntry($row['header'], $row, $tags, $row['uid'], $additionalFields, $indexerConfig);
                 }
             }
             // compile title from page title and content element title
             // TODO: make changeable via hook
             $title = $this->cachedPageRecords[$row['sys_language_uid']][$row['pid']]['title'];
             if ($row['header'] && $row['header_layout'] != 100) {
                 $title = $title . ' - ' . $row['header'];
             }
             // save record to index
             $this->pObj->storeInIndex($indexerConfig['storagepid'], $title, 'content', $row['pid'] . '#c' . $row['uid'], $content, $tags, '', '', $row['sys_language_uid'], $starttime, $endtime, $feGroups, false, $additionalFields);
             // count elements written to the index
             $this->counter++;
         }
     } else {
         return;
     }
     return;
 }
 /**
  * Add Tags to records array
  *
  * @param array Simple array with uids of pages
  * @param string additional where-clause
  * @return array extended array with uids and tags for records
  */
 public function addTagsToRecords($uids, $pageWhere = '1=1')
 {
     $tagChar = $this->pObj->extConf['prePostTagChar'];
     // add tags which are defined by page properties
     $fields = 'pages.*, GROUP_CONCAT(CONCAT("' . $tagChar . '", tx_kesearch_filteroptions.tag, "' . $tagChar . '")) as tags';
     $table = 'pages, tx_kesearch_filteroptions';
     $where = 'pages.uid IN (' . implode(',', $uids) . ')';
     $where .= ' AND pages.tx_kesearch_tags <> "" ';
     $where .= ' AND FIND_IN_SET(tx_kesearch_filteroptions.uid, pages.tx_kesearch_tags)';
     $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tx_kesearch_filteroptions');
     $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tx_kesearch_filteroptions');
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where, 'pages.uid', '', '');
     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         $this->pageRecords[$row['uid']]['tags'] = $row['tags'];
     }
     // add system categories as tags
     foreach ($uids as $page_uid) {
         tx_kesearch_helper::makeSystemCategoryTags($this->pageRecords[$page_uid]['tags'], $page_uid, 'pages');
     }
     // add tags which are defined by filteroption records
     $fields = 'automated_tagging, automated_tagging_exclude, tag';
     $table = 'tx_kesearch_filteroptions';
     $where = 'automated_tagging <> "" ';
     $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tx_kesearch_filteroptions');
     $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tx_kesearch_filteroptions');
     $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fields, $table, $where);
     $where = $pageWhere . ' AND no_search <> 1 ';
     foreach ($rows as $row) {
         $tempTags = array();
         if ($row['automated_tagging_exclude'] > '') {
             $whereRow = $where . 'AND FIND_IN_SET(pages.pid, "' . $row['automated_tagging_exclude'] . '") = 0';
         } else {
             $whereRow = $where;
         }
         $pageList = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->queryGen->getTreeList($row['automated_tagging'], 99, 0, $whereRow));
         foreach ($pageList as $uid) {
             if ($this->pageRecords[$uid]['tags']) {
                 $this->pageRecords[$uid]['tags'] .= ',' . $tagChar . $row['tag'] . $tagChar;
             } else {
                 $this->pageRecords[$uid]['tags'] = $tagChar . $row['tag'] . $tagChar;
             }
         }
     }
 }
 /**
  * Injects ke_search extension config
  */
 protected function injectKeSearchExtensionConfig()
 {
     $this->keSearchExtensionConfig = \tx_kesearch_helper::getExtConf();
 }