Пример #1
0
 public function setUp()
 {
     Tx_Solr_Util::initializeTsfe('1');
     $GLOBALS['TSFE']->tmpl->getFileName_backPath = PATH_site;
     $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['search.']['targetPage'] = '0';
     $GLOBALS['TSFE']->tmpl->setup['config.']['tx_realurl_enable'] = '0';
     // setup up ts objects
     $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['search.']['detailPage'] = 5050;
     $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['renderObjects.'] = array('testContent' => 'TEXT', 'testContent.' => array('field' => 'argument_0'), 'testContent2' => 'TEXT', 'testContent2.' => array('field' => 'argument_1', 'stripHtml' => 1));
     $this->fixtures = array('argument content', '<span>argument content with html</span>', 'third argument content');
     $this->viewHelper = new Tx_Solr_viewhelper_Ts();
 }
 public function setUp()
 {
     Tx_Solr_Util::initializeTsfe('1');
     $GLOBALS['TSFE']->tmpl->getFileName_backPath = PATH_site;
     $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['search.']['targetPage'] = '0';
     $GLOBALS['TSFE']->tmpl->setup['config.']['tx_realurl_enable'] = '0';
     $facetName = 'TestFacet';
     $facetOptions = array('testoption' => 1);
     $facetConfiguration = array('selectingSelectedFacetOptionRemovesFilter' => 0, 'renderingInstruction');
     $parentPlugin = t3lib_div::makeInstance('Tx_Solr_PiResults_Results');
     $parentPlugin->cObj = t3lib_div::makeInstance('tslib_cObj');
     $parentPlugin->main('', array());
     $query = t3lib_div::makeInstance('Tx_Solr_Query', array('test'));
     $this->facetRenderer = t3lib_div::makeInstance('Tx_Solr_Facet_SimpleFacetRenderer', $facetName, $facetOptions, $facetConfiguration, $parentPlugin->getTemplate(), $query);
     $this->facetRenderer->setLinkTargetPageId($parentPlugin->getLinkTargetPageId());
 }
    /**
     * Checks whether config.index_enable is set to 1, otherwise indexing will
     * not work.
     *
     * @return	NULL|tx_reports_reports_status_Status	An error status is returned for each site root page config.index_enable = 0.
     */
    protected function getConfigIndexEnableStatus()
    {
        $status = NULL;
        $rootPages = $this->getRootPages();
        $rootPagesWithIndexingOff = array();
        foreach ($rootPages as $rootPage) {
            try {
                Tx_Solr_Util::initializeTsfe($rootPage['uid']);
                if (!$GLOBALS['TSFE']->config['config']['index_enable']) {
                    $rootPagesWithIndexingOff[] = $rootPage;
                }
            } catch (RuntimeException $rte) {
                $rootPagesWithIndexingOff[] = $rootPage;
            } catch (t3lib_error_http_ServiceUnavailableException $sue) {
                if ($sue->getCode() == 1294587218) {
                    //  No TypoScript template found, continue with next site
                    $rootPagesWithIndexingOff[] = $rootPage;
                    continue;
                }
            }
        }
        if (!empty($rootPagesWithIndexingOff)) {
            foreach ($rootPagesWithIndexingOff as $key => $rootPageWithIndexingOff) {
                $rootPagesWithIndexingOff[$key] = '[' . $rootPageWithIndexingOff['uid'] . '] ' . $rootPageWithIndexingOff['title'];
            }
            $status = t3lib_div::makeInstance('tx_reports_reports_status_Status', 'Page Indexing', 'Indexing is disabled', 'You need to set config.index_enable = 1 to allow page indexing.
				The following sites were found with indexing disabled:
				<ul><li>' . implode('</li><li>', $rootPagesWithIndexingOff) . '</li></ul>', tx_reports_reports_status_Status::ERROR);
        }
        return $status;
    }
Пример #4
0
 /**
  * Gets the full item record.
  *
  * This general record indexer simply gets the record from the item. Other
  * more specialized indexers may provide more data for their specific item
  * types.
  *
  * @param Tx_Solr_IndexQueue_Item $item The item to be indexed
  * @param integer $language Language Id (sys_language.uid)
  * @return array|NULL The full record with fields of data to be used for indexing or NULL to prevent an item from being indexed
  */
 protected function getFullItemRecord(Tx_Solr_IndexQueue_Item $item, $language = 0)
 {
     $rootPageUid = $item->getRootPageUid();
     $overlayIdentifier = $rootPageUid . '|' . $language;
     if (!isset($this->sysLanguageOverlay[$overlayIdentifier])) {
         Tx_Solr_Util::initializeTsfe($rootPageUid, $language);
         $this->sysLanguageOverlay[$overlayIdentifier] = $GLOBALS['TSFE']->sys_language_contentOL;
     }
     $itemRecord = $item->getRecord();
     if ($language > 0) {
         $page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_pageSelect');
         $page->init(FALSE);
         $itemRecord = $page->getRecordOverlay($item->getType(), $itemRecord, $language, $this->sysLanguageOverlay[$rootPageUid . '|' . $language]);
     }
     if (!$itemRecord) {
         $itemRecord = NULL;
     }
     /*
      * Skip disabled records. This happens if the default language record
      * is hidden but a certain translation isn't. Then the default language
      * document appears here but must not be indexed.
      */
     if (!empty($GLOBALS['TCA'][$item->getType()]['ctrl']['enablecolumns']['disabled']) && $itemRecord[$GLOBALS['TCA'][$item->getType()]['ctrl']['enablecolumns']['disabled']]) {
         $itemRecord = NULL;
     }
     /*
      * Skip translation mismatching records. Sometimes the requested language
      * doesn't fit the returned language. This might happen with content fallback
      * and is perfectly fine in general.
      * But if the requested language doesn't match the returned language and
      * the given record has no translation parent, the indexqueue_item most
      * probably pointed to a non-translated language record that is dedicated
      * to a very specific language. Now we have to avoid indexing this record
      * into all language cores.
      */
     $translationOriginalPointerField = 'l10n_parent';
     if (!empty($GLOBALS['TCA'][$item->getType()]['ctrl']['transOrigPointerField'])) {
         $translationOriginalPointerField = $GLOBALS['TCA'][$item->getType()]['ctrl']['transOrigPointerField'];
     }
     $languageField = $GLOBALS['TCA'][$item->getType()]['ctrl']['languageField'];
     if ($itemRecord[$translationOriginalPointerField] == 0 && $this->sysLanguageOverlay[$overlayIdentifier] != 1 && !empty($languageField) && $itemRecord[$languageField] != $language && $itemRecord[$languageField] != '-1') {
         $itemRecord = NULL;
     }
     if (!is_null($itemRecord)) {
         $itemRecord['__solr_index_language'] = $language;
     }
     return $itemRecord;
 }
Пример #5
0
 /**
  * Gets the site's config.sys_language_mode setting
  *
  * @return string The site's config.sys_language_mode
  */
 public function getSysLanguageMode()
 {
     if (is_null($this->sysLanguageMode)) {
         Tx_Solr_Util::initializeTsfe($this->getRootPageId());
         $this->sysLanguageMode = $GLOBALS['TSFE']->sys_language_mode;
     }
     return $this->sysLanguageMode;
 }