当前位置: 首页>>代码示例>>PHP>>正文


PHP Tx_Solr_Util类代码示例

本文整理汇总了PHP中Tx_Solr_Util的典型用法代码示例。如果您正苦于以下问题:PHP Tx_Solr_Util类的具体用法?PHP Tx_Solr_Util怎么用?PHP Tx_Solr_Util使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Tx_Solr_Util类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * Returns an URL that switches the sorting indicator according to the
  * given sorting direction
  *
  * @param array $arguments Expects 'asc' or 'desc' as sorting direction in key 0
  * @return string
  * @throws InvalidArgumentException when providing an invalid sorting direction
  */
 public function execute(array $arguments = array())
 {
     $content = '';
     $sortDirection = trim($arguments[0]);
     $configuration = Tx_Solr_Util::getSolrConfiguration();
     $contentObject = t3lib_div::makeInstance('tslib_cObj');
     $defaultImagePrefix = 'EXT:solr/Resources/Images/Indicator';
     switch ($sortDirection) {
         case 'asc':
             $imageConfiguration = $configuration['viewHelpers.']['sortIndicator.']['up.'];
             if (!isset($imageConfiguration['file'])) {
                 $imageConfiguration['file'] = $defaultImagePrefix . 'Up.png';
             }
             $content = $contentObject->IMAGE($imageConfiguration);
             break;
         case 'desc':
             $imageConfiguration = $configuration['viewHelpers.']['sortIndicator.']['down.'];
             if (!isset($imageConfiguration['file'])) {
                 $imageConfiguration['file'] = $defaultImagePrefix . 'Down.png';
             }
             $content = $contentObject->IMAGE($imageConfiguration);
             break;
         case '###SORT.CURRENT_DIRECTION###':
         case '':
             // ignore
             break;
         default:
             throw new InvalidArgumentException('Invalid sorting direction "' . $arguments[0] . '", must be "asc" or "desc".', 1390868460);
     }
     return $content;
 }
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:39,代码来源:SortIndicator.php

示例2: execute

 /**
  * Creates a link to a given page with a given link text
  *
  * @param	array	Array of arguments, [0] is the link text, [1] is the (optional) page Id to link to (otherwise TSFE->id), [2] are additional URL parameters, [3] use cache, defaults to FALSE, [4] additional A tag parameters
  * @return	string	complete anchor tag with URL and link text
  */
 public function execute(array $arguments = array())
 {
     $linkText = $arguments[0];
     $additionalParameters = $arguments[2] ? $arguments[2] : '';
     $useCache = $arguments[3] ? TRUE : FALSE;
     $ATagParams = $arguments[4] ? $arguments[4] : '';
     // by default or if no link target is set, link to the current page
     $linkTarget = $GLOBALS['TSFE']->id;
     // if the link target is a number, interprete it as a page ID
     $linkArgument = trim($arguments[1]);
     if (is_numeric($linkArgument)) {
         $linkTarget = intval($linkArgument);
     } elseif (!empty($linkArgument) && is_string($linkArgument)) {
         if (Tx_Solr_Util::isValidTypoScriptPath($linkArgument)) {
             try {
                 $typoscript = Tx_Solr_Util::getTypoScriptObject($linkArgument);
                 $pathExploded = explode('.', $linkArgument);
                 $lastPathSegment = array_pop($pathExploded);
                 $linkTarget = intval($typoscript[$lastPathSegment]);
             } catch (InvalidArgumentException $e) {
                 // ignore exceptions caused by markers, but accept the exception for wrong TS paths
                 if (substr($linkArgument, 0, 3) != '###') {
                     throw $e;
                 }
             }
         } elseif (\TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($linkArgument) || \TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST') . '/' . $linkArgument)) {
             // $linkTarget is an URL
             $linkTarget = filter_var($linkArgument, FILTER_SANITIZE_URL);
         }
     }
     $linkConfiguration = array('useCacheHash' => $useCache, 'no_cache' => FALSE, 'parameter' => $linkTarget, 'additionalParams' => $additionalParameters, 'ATagParams' => $ATagParams);
     return $this->contentObject->typoLink($linkText, $linkConfiguration);
 }
开发者ID:punktDe,项目名称:solr,代码行数:39,代码来源:Link.php

示例3: initializeSearchComponent

 /**
  * Initializes the search component.
  *
  * Sets the debug query parameter
  *
  */
 public function initializeSearchComponent()
 {
     $solrConfiguration = Tx_Solr_Util::getSolrConfiguration();
     if ($solrConfiguration['enableDebugMode']) {
         $this->query->setDebugMode();
     }
 }
开发者ID:romaincanon,项目名称:ext-solr,代码行数:13,代码来源:DebugComponent.php

示例4: __construct

 /**
  * Constructor for class Tx_Solr_ViewHelper_Multivalue
  *
  */
 public function __construct(array $arguments = array())
 {
     $configuration = Tx_Solr_Util::getSolrConfiguration();
     if (!empty($configuration['viewhelpers.']['multivalue.']['glue'])) {
         $this->glue = $configuration['viewhelpers.']['multivalue.']['glue'];
     }
 }
开发者ID:romaincanon,项目名称:ext-solr,代码行数:11,代码来源:Multivalue.php

示例5: process

 /**
  * Expects a timestamp and converts it to an ISO 8601 date as needed by Solr.
  *
  * Example date output format: 1995-12-31T23:59:59Z
  * The trailing "Z" designates UTC time and is mandatory
  *
  * @param array Array of values, an array because of multivalued fields
  * @return array Modified array of values
  */
 public function process(array $values)
 {
     $results = array();
     foreach ($values as $timestamp) {
         $results[] = Tx_Solr_Util::timestampToIso($timestamp);
     }
     return $results;
 }
开发者ID:romaincanon,项目名称:ext-solr,代码行数:17,代码来源:TimestampToIsoDate.php

示例6: initializeSearchComponent

 /**
  * Initializes the search component.
  *
  */
 public function initializeSearchComponent()
 {
     $solrConfiguration = Tx_Solr_Util::getSolrConfiguration();
     if (!empty($solrConfiguration['statistics'])) {
         $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['modifySearchQuery']['statistics'] = 'Tx_Solr_Query_Modifier_Statistics';
         $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['processSearchResponse']['statistics'] = 'Tx_Solr_Response_Processor_StatisticsWriter';
     }
 }
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:12,代码来源:StatisticsComponent.php

示例7: __construct

 /**
  * Constructor.
  *
  * @param string $facetName Facet Name
  * @param integer|string $facetOptionValue Facet option value
  * @param integer $facetOptionNumberOfResults number of results to be returned when applying this option's filter
  */
 public function __construct($facetName, $facetOptionValue, $facetOptionNumberOfResults = 0)
 {
     $this->facetName = $facetName;
     $this->value = $facetOptionValue;
     $this->numberOfResults = intval($facetOptionNumberOfResults);
     $solrConfiguration = Tx_Solr_Util::getSolrConfiguration();
     $this->facetConfiguration = $solrConfiguration['search.']['faceting.']['facets.'][$this->facetName . '.'];
 }
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:15,代码来源:FacetOption.php

示例8: execute

 /**
  * Works through the indexing queue and indexes the queued items into Solr.
  *
  * @return	boolean	Returns TRUE on success, FALSE if no items were indexed or none were found.
  * @see	typo3/sysext/scheduler/tx_scheduler_Task#execute()
  */
 public function execute()
 {
     $executionSucceeded = FALSE;
     $this->configuration = Tx_Solr_Util::getSolrConfigurationFromPageId($this->site->getRootPageId());
     $this->indexItems();
     $this->cleanIndex();
     $executionSucceeded = TRUE;
     return $executionSucceeded;
 }
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:15,代码来源:IndexQueueWorkerTask.php

示例9: __construct

 /**
  * Constructor.
  *
  * @param Tx_Solr_Facet_Facet $facet The facet to render.
  */
 public function __construct(Tx_Solr_Facet_Facet $facet)
 {
     $this->search = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Solr_Search');
     $this->facet = $facet;
     $this->facetName = $facet->getName();
     $this->solrConfiguration = Tx_Solr_Util::getSolrConfiguration();
     $this->facetConfiguration = $this->solrConfiguration['search.']['faceting.']['facets.'][$this->facetName . '.'];
     $this->linkTargetPageId = $GLOBALS['TSFE']->id;
     $this->queryLinkBuilder = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Solr_Query_LinkBuilder', $this->search->getQuery());
 }
开发者ID:punktDe,项目名称:solr,代码行数:15,代码来源:AbstractFacetRenderer.php

示例10: decodeFilter

 /**
  * Parses the given date range from a GET parameter and returns a Solr
  * date range filter.
  *
  * @param string $rangeFilter The range filter query string from the query URL
  * @param array $configuration Facet configuration
  * @return string Lucene query language filter to be used for querying Solr
  */
 public function decodeFilter($dateRange, array $configuration = array())
 {
     list($dateRangeStart, $dateRangeEnd) = explode(self::DELIMITER, $dateRange);
     $dateRangeEnd .= '59';
     // adding 59 seconds
     // TODO for PHP 5.3 use date_parse_from_format() / date_create_from_format() / DateTime::createFromFormat()
     $dateRangeFilter = '[' . Tx_Solr_Util::timestampToIso(strtotime($dateRangeStart));
     $dateRangeFilter .= ' TO ';
     $dateRangeFilter .= Tx_Solr_Util::timestampToIso(strtotime($dateRangeEnd)) . ']';
     return $dateRangeFilter;
 }
开发者ID:romaincanon,项目名称:ext-solr,代码行数:19,代码来源:DateRange.php

示例11: __construct

 /**
  * Constructor.
  *
  * @param Tx_Solr_Query $query Solr query
  */
 public function __construct(Tx_Solr_Query $query)
 {
     $this->solrConfiguration = Tx_Solr_Util::getSolrConfiguration();
     $this->contentObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tslib_cObj');
     $this->query = $query;
     $targetPageUid = $this->contentObject->stdWrap($this->solrConfiguration['search.']['targetPage'], $this->solrConfiguration['search.']['targetPage.']);
     $this->linkTargetPageId = $targetPageUid;
     if (empty($this->linkTargetPageId)) {
         $this->linkTargetPageId = $GLOBALS['TSFE']->id;
     }
 }
开发者ID:punktDe,项目名称:solr,代码行数:16,代码来源:LinkBuilder.php

示例12: setUp

 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();
 }
开发者ID:romaincanon,项目名称:ext-solr,代码行数:12,代码来源:TsTest.php

示例13: __construct

 /**
  * constructor for class Tx_Solr_ViewHelper_Crop
  */
 public function __construct(array $arguments = array())
 {
     $configuration = Tx_Solr_Util::getSolrConfiguration();
     if (!empty($configuration['viewHelpers.']['crop.']['maxLength'])) {
         $this->maxLength = $configuration['viewHelpers.']['crop.']['maxLength'];
     }
     if (!empty($configuration['viewHelpers.']['crop.']['cropIndicator'])) {
         $this->cropIndicator = $configuration['viewHelpers.']['crop.']['cropIndicator'];
     }
     if (isset($configuration['viewHelpers.']['crop.']['cropFullWords'])) {
         $this->cropFullWords = (bool) $configuration['viewHelpers.']['crop.']['cropFullWords'];
     }
 }
开发者ID:punktDe,项目名称:solr,代码行数:16,代码来源:Crop.php

示例14: setUp

 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());
 }
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:16,代码来源:SimpleFacetRendererTest.php

示例15: modifyResultDocument

 /**
  * Modifies the given document and returns the modified document as result.
  *
  * @param Tx_Solr_PiResults_ResultsCommand $resultCommand The search result command
  * @param array $resultDocument Result document as array
  * @return array The document with fields as array
  */
 public function modifyResultDocument($resultCommand, array $resultDocument)
 {
     $this->search = $resultCommand->getParentPlugin()->getSearch();
     $configuration = Tx_Solr_Util::getSolrConfiguration();
     $highlightedContent = $this->search->getHighlightedContent();
     $highlightFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $configuration['search.']['results.']['resultsHighlighting.']['highlightFields'], TRUE);
     foreach ($highlightFields as $highlightField) {
         if (!empty($highlightedContent->{$resultDocument['id']}->{$highlightField}[0])) {
             $fragments = array();
             foreach ($highlightedContent->{$resultDocument['id']}->{$highlightField} as $fragment) {
                 $fragments[] = tx_solr_Template::escapeMarkers($fragment);
             }
             $resultDocument[$highlightField] = implode(' ' . $configuration['search.']['results.']['resultsHighlighting.']['fragmentSeparator'] . ' ', $fragments);
         }
     }
     return $resultDocument;
 }
开发者ID:punktDe,项目名称:solr,代码行数:24,代码来源:HighlightingResultDocumentModifier.php


注:本文中的Tx_Solr_Util类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。