• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Solr\Site类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getAdditionalInformation

 /**
  * Returns some additional information about indexing progress, shown in
  * the scheduler's task overview list.
  *
  * @return string Information to display
  */
 public function getAdditionalInformation()
 {
     $message = 'Site: ' . $this->site->getLabel();
     $failedItemsCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'tx_solr_indexqueue_item', 'root = ' . $this->site->getRootPageId() . ' AND errors != \'\'');
     if ($failedItemsCount) {
         $message .= ' Failures: ' . $failedItemsCount;
     }
     return $message;
 }
开发者ID:hnadler,项目名称:ext-solr,代码行数:15,代码来源:IndexQueueWorkerTask.php


示例2: initializePageIndexQueue

 /**
  * Initialize page index queue
  *
  * @return void
  */
 protected function initializePageIndexQueue()
 {
     $this->pageInitializer->setIndexingConfigurationName('pages');
     $this->pageInitializer->setSite(Site::getFirstAvailableSite());
     $this->pageInitializer->setType('pages');
     $this->pageInitializer->initialize();
 }
开发者ID:sitegeist,项目名称:ext-solr,代码行数:12,代码来源:PageTest.php


示例3: getAdditionalInformation

 /**
  * This method is designed to return some additional information about the task,
  * that may help to set it apart from other tasks from the same class
  * This additional information is used - for example - in the Scheduler's BE module
  * This method should be implemented in most task classes
  *
  * @return string Information to display
  */
 public function getAdditionalInformation()
 {
     $information = '';
     if ($this->site) {
         $information = 'Site: ' . $this->site->getLabel();
     }
     if (!empty($this->indexingConfigurationsToReIndex)) {
         $information .= ', Indexing Configurations: ' . implode(', ', $this->indexingConfigurationsToReIndex);
     }
     return $information;
 }
开发者ID:sitegeist,项目名称:ext-solr,代码行数:19,代码来源:ReIndexTask.php


示例4: resolveSite

 /**
  * @return void
  */
 protected function resolveSite()
 {
     $this->site = $this->moduleData->getSite();
     if (!$this->site instanceof Site) {
         $this->initializeSiteFromFirstAvailableAndStoreInModuleData();
     }
     $rootPageId = $this->site instanceof Site ? $this->site->getRootPageId() : 0;
     if ($rootPageId > 0 && !Util::pageExists($rootPageId)) {
         $this->initializeSiteFromFirstAvailableAndStoreInModuleData();
     }
 }
开发者ID:sitegeist,项目名称:ext-solr,代码行数:14,代码来源:AdministrationController.php


示例5: validateAdditionalFields

 /**
  * Checks any additional data that is relevant to this task. If the task
  * class is not relevant, the method is expected to return TRUE
  *
  * @param array $submittedData reference to the array containing the data submitted by the user
  * @param SchedulerModuleController $schedulerModule reference to the calling object (Scheduler's BE module)
  * @return boolean True if validation was ok (or selected class is not relevant), FALSE otherwise
  */
 public function validateAdditionalFields(array &$submittedData, SchedulerModuleController $schedulerModule)
 {
     $result = false;
     // validate site
     $sites = Site::getAvailableSites();
     if (array_key_exists($submittedData['site'], $sites)) {
         $result = true;
     }
     // escape limit
     $submittedData['documentsToIndexLimit'] = intval($submittedData['documentsToIndexLimit']);
     return $result;
 }
开发者ID:sascha-egerer,项目名称:ext-solr,代码行数:20,代码来源:IndexQueueWorkerTaskAdditionalFieldProvider.php


示例6: render

 /**
  * @return mixed
  */
 public function render()
 {
     $availableSites = Site::getAvailableSites();
     $currentSite = $this->moduleDataStorageService->loadModuleData()->getSite();
     $hasSites = is_array($availableSites) && count($availableSites) > 0;
     $this->templateVariableContainer->add('availableSites', $availableSites);
     $this->templateVariableContainer->add('currentSite', $currentSite);
     $this->templateVariableContainer->add('hasSites', $hasSites);
     $output = $this->renderChildren();
     $this->templateVariableContainer->remove('hasSites');
     $this->templateVariableContainer->remove('currentSite');
     $this->templateVariableContainer->remove('availableSites');
     return $output;
 }
开发者ID:hnadler,项目名称:ext-solr,代码行数:17,代码来源:SitesViewHelper.php


示例7: preFilledQueueContainsRootPageAfterInitialize

 /**
  * @test
  */
 public function preFilledQueueContainsRootPageAfterInitialize()
 {
     $this->importDataSetFromFixture('can_clear_queue_after_initialize.xml');
     $itemCount = $this->indexQueue->getAllItemsCount();
     $this->assertItemsInQueue(1);
     $this->assertFalse($this->indexQueue->containsItem('pages', 1));
     $this->assertTrue($this->indexQueue->containsItem('pages', 4711));
     // after initialize the prefilled queue item should be lost and the root page should be added again
     $site = Site::getFirstAvailableSite();
     $this->indexQueue->initialize($site, 'pages');
     $this->assertItemsInQueue(1);
     $this->assertTrue($this->indexQueue->containsItem('pages', 1));
     $this->assertFalse($this->indexQueue->containsItem('pages', 4711));
 }
开发者ID:hnadler,项目名称:ext-solr,代码行数:17,代码来源:QueueTest.php


示例8: render

 public function render()
 {
     $this->tag->addAttribute('onchange', 'jumpToUrl(document.URL + \'&tx_solr_tools_solradministration[action]=setSite&tx_solr_tools_solradministration[site]=\'+this.options[this.selectedIndex].value,this);');
     $sites = Site::getAvailableSites();
     $currentSite = $this->moduleDataStorageService->loadModuleData()->getSite();
     $options = '';
     foreach ($sites as $site) {
         $selectedAttribute = '';
         if ($site == $currentSite) {
             $selectedAttribute = ' selected="selected"';
         }
         $options .= '<option value="' . $site->getRootPageId() . '"' . $selectedAttribute . '>' . $site->getLabel() . '</option>';
     }
     $this->tag->setContent($options);
     return '<div class="docheader-funcmenu siteSelector"><label>Site: </label>' . $this->tag->render() . '</div>';
 }
开发者ID:Gregor-Agnes,项目名称:ext-solr,代码行数:16,代码来源:SiteSelectorMenuViewHelper.php


示例9: getSiteHashFilterForTSFE

 /**
  * Retrieves the value that should be used for the SiteHash filter.
  *
  * @param TypoScriptFrontendController $TSFE
  * @return string
  */
 protected function getSiteHashFilterForTSFE(TypoScriptFrontendController $TSFE)
 {
     return Site::getSiteByPageId($TSFE->id)->getDomain();
 }
开发者ID:timohund,项目名称:ext-solrmlt,代码行数:10,代码来源:Builder.php


示例10: resolveSiteHashAllowedSites

 /**
  * Resolves magic keywords in allowed sites configuration.
  * Supported keywords:
  *   __solr_current_site - The domain of the site the query has been started from
  *   __current_site - Same as __solr_current_site
  *   __all - Adds all domains as allowed sites
  *   * - Same as __all
  *
  * @param integer $pageId A page ID that is then resolved to the site it belongs to
  * @param string $allowedSitesConfiguration TypoScript setting for allowed sites
  * @return string List of allowed sites/domains, magic keywords resolved
  */
 public static function resolveSiteHashAllowedSites($pageId, $allowedSitesConfiguration)
 {
     if ($allowedSitesConfiguration == '*' || $allowedSitesConfiguration == '__all') {
         $sites = Site::getAvailableSites();
         $domains = array();
         foreach ($sites as $site) {
             $domains[] = $site->getDomain();
         }
         $allowedSites = implode(',', $domains);
     } else {
         $allowedSites = str_replace(array('__solr_current_site', '__current_site'), Site::getSiteByPageId($pageId)->getDomain(), $allowedSitesConfiguration);
     }
     return $allowedSites;
 }
开发者ID:stmllr,项目名称:ext-solr,代码行数:26,代码来源:Util.php


示例11: initializeSiteFromFirstAvailableAndStoreInModuleData

 /**
  * Resets the stored site to the first available site.
  *
  * @return void‚
  */
 protected function initializeSiteFromFirstAvailableAndStoreInModuleData()
 {
     $site = Site::getFirstAvailableSite();
     $this->setSiteAndResetCore($site);
     $this->site = $site;
 }
开发者ID:kalypso63,项目名称:ext-solr,代码行数:11,代码来源:AdministrationController.php


示例12: getPageDocument

 /**
  * Builds the Solr document for the current page.
  *
  * @return \Apache_Solr_Document A document representing the page
  */
 protected function getPageDocument()
 {
     $document = GeneralUtility::makeInstance('\\Apache_Solr_Document');
     /* @var $document \Apache_Solr_Document */
     $site = Site::getSiteByPageId($this->page->id);
     $pageRecord = $this->page->page;
     self::$pageSolrDocumentId = $documentId = Util::getPageDocumentId($this->page->id, $this->page->type, $this->page->sys_language_uid, $this->getDocumentIdGroups());
     $document->setField('id', $documentId);
     $document->setField('site', $site->getDomain());
     $document->setField('siteHash', $site->getSiteHash());
     $document->setField('appKey', 'EXT:solr');
     $document->setField('type', 'pages');
     // system fields
     $document->setField('uid', $this->page->id);
     $document->setField('pid', $pageRecord['pid']);
     $document->setField('typeNum', $this->page->type);
     $document->setField('created', $pageRecord['crdate']);
     $document->setField('changed', $pageRecord['tstamp']);
     $document->setField('rootline', $this->page->id);
     // access
     $document->setField('access', (string) $this->pageAccessRootline);
     if ($this->page->page['endtime']) {
         $document->setField('endtime', $pageRecord['endtime']);
     }
     // content
     $document->setField('title', $this->contentExtractor->getPageTitle());
     $document->setField('subTitle', $pageRecord['subtitle']);
     $document->setField('navTitle', $pageRecord['nav_title']);
     $document->setField('author', $pageRecord['author']);
     $document->setField('description', $pageRecord['description']);
     $document->setField('abstract', $pageRecord['abstract']);
     $document->setField('content', $this->contentExtractor->getIndexableContent());
     $document->setField('url', $this->pageUrl);
     // keywords, multi valued
     $keywords = array_unique(GeneralUtility::trimExplode(',', $pageRecord['keywords'], TRUE));
     foreach ($keywords as $keyword) {
         $document->addField('keywords', $keyword);
     }
     // content from several tags like headers, anchors, ...
     $tagContent = $this->contentExtractor->getTagContent();
     foreach ($tagContent as $fieldName => $fieldValue) {
         $document->setField($fieldName, $fieldValue);
     }
     return $document;
 }
开发者ID:neufeind,项目名称:ext-solr,代码行数:50,代码来源:Typo3PageIndexer.php


示例13: canGetAdditionalInformationFromTask

 /**
  * @test
  */
 public function canGetAdditionalInformationFromTask()
 {
     $this->importDataSetFromFixture('can_trigger_frontend_calls_for_page_index.xml');
     $site = Site::getFirstAvailableSite();
     /** @var $indexQueueQueueWorkerTask \ApacheSolrForTypo3\Solr\Task\IndexQueueWorkerTask */
     $indexQueueQueueWorkerTask = GeneralUtility::makeInstance('ApacheSolrForTypo3\\Solr\\Task\\IndexQueueWorkerTask');
     $indexQueueQueueWorkerTask->setDocumentsToIndexLimit(1);
     $indexQueueQueueWorkerTask->setSite($site);
     $additionalInformation = $indexQueueQueueWorkerTask->getAdditionalInformation();
     $this->assertContains('Root Page ID: 1', $additionalInformation);
     $this->assertContains('Site: page for testing', $additionalInformation);
 }
开发者ID:sitegeist,项目名称:ext-solr,代码行数:15,代码来源:IndexQueueWorkerTaskTest.php


示例14: canGetDefaultLanguage

 /**
  * @test
  */
 public function canGetDefaultLanguage()
 {
     $this->importDataSetFromFixture('can_get_default_language.xml');
     $site = Site::getFirstAvailableSite();
     $this->assertEquals(888, $site->getDefaultLanguage(), 'Could not get default language from site');
 }
开发者ID:hnadler,项目名称:ext-solr,代码行数:9,代码来源:SiteTest.php


示例15: resolveMountPageTree

 /**
  * Gets all the pages from a mounted page tree.
  *
  * @param integer $mountPageSourceId
  * @return array An array of page IDs in the mounted page tree
  */
 protected function resolveMountPageTree($mountPageSourceId)
 {
     $mountedSite = Site::getSiteByPageId($mountPageSourceId);
     return $mountedSite->getPages($mountPageSourceId);
 }
开发者ID:kalypso63,项目名称:ext-solr,代码行数:11,代码来源:Page.php


示例16: getIndexDocuments

 /**
  * Queries Solr for the current page's documents.
  *
  * @return array An array of Apache_Solr_Document objects
  */
 protected function getIndexDocuments()
 {
     /* @var Query $query */
     $query = GeneralUtility::makeInstance('ApacheSolrForTypo3\\Solr\\Query', '');
     $query->setQueryType('standard');
     $query->useRawQueryString(true);
     $query->setQueryString('*:*');
     $query->addFilter('(type:pages AND uid:' . $this->pageId . ') OR (*:* AND pid:' . $this->pageId . ' NOT type:pages)');
     $query->addFilter('siteHash:' . Site::getSiteByPageId($this->pageId)->getSiteHash());
     $query->setFieldList('*');
     $query->setSorting('type asc, title asc');
     $this->search->search($query, 0, 10000);
     return $this->search->getResultDocumentsEscaped();
 }
开发者ID:hnadler,项目名称:ext-solr,代码行数:19,代码来源:IndexInspectorRemoteController.php


示例17: getConfigurationsBySite

 /**
  * Gets all connection configurations for a given site.
  *
  * @param Site $site A TYPO3 site
  * @return array An array of Solr connection configurations for a site
  */
 public function getConfigurationsBySite(Site $site)
 {
     $solrConfigurations = array();
     $allConfigurations = $this->getAllConfigurations();
     foreach ($allConfigurations as $configuration) {
         if ($configuration['rootPageUid'] == $site->getRootPageId()) {
             $solrConfigurations[] = $configuration;
         }
     }
     return $solrConfigurations;
 }
开发者ID:Gregor-Agnes,项目名称:ext-solr,代码行数:17,代码来源:ConnectionManager.php


示例18: canResolveAbsRefPrefix

 /**
  *
  * @dataProvider canResolveAbsRefPrefixDataProvider
  * @param string $absRefPrefix
  * @param string $expectedUrl
  * @test
  */
 public function canResolveAbsRefPrefix($absRefPrefix, $expectedUrl)
 {
     $this->cleanUpSolrServerAndAssertEmpty();
     // create fake extension database table and TCA
     $this->importDumpFromFixture('fake_extension2_table.sql');
     $GLOBALS['TCA']['tx_fakeextension_domain_model_bar'] = (include $this->getFixturePath('fake_extension2_bar_tca.php'));
     $GLOBALS['TCA']['tx_fakeextension_domain_model_directrelated'] = (include $this->getFixturePath('fake_extension2_directrelated_tca.php'));
     $this->importDataSetFromFixture('can_index_custom_record_absRefPrefix_' . $absRefPrefix . '.xml');
     $this->addToIndexQueue('tx_fakeextension_domain_model_bar', 111);
     /** @var  $cliEnvironment CliEnvironment */
     $cliEnvironment = GeneralUtility::makeInstance(CliEnvironment::class);
     $cliEnvironment->backup();
     $cliEnvironment->initialize(PATH_site);
     /** @var $indexService IndexService */
     $site = Site::getFirstAvailableSite();
     $indexService = GeneralUtility::makeInstance(IndexService::class, $site);
     // run the indexer
     $indexService->indexItems(1);
     $cliEnvironment->restore();
     // do we have the record in the index with the value from the mm relation?
     sleep(2);
     $solrContent = file_get_contents('http://localhost:8080/solr/core_en/select?q=*:*');
     $this->assertContains('"numFound":1', $solrContent, 'Could not index document into solr');
     $this->assertContains('"url":"' . $expectedUrl . '"', $solrContent, 'Generated unexpected url with absRefPrefix = auto');
     $this->assertNotContains('auto', $solrContent, 'absRefPrefix=auto was not resolved');
     $this->cleanUpSolrServerAndAssertEmpty();
 }
开发者ID:sitegeist,项目名称:ext-solr,代码行数:34,代码来源:IndexServiceTest.php


示例19: getItemsToIndex

 /**
  * Gets $limit number of items to index for a particular $site.
  *
  * @param Site $site TYPO3 site
  * @param integer $limit Number of items to get from the queue
  * @return Item[] Items to index to the given solr server
  */
 public function getItemsToIndex(Site $site, $limit = 50)
 {
     $itemsToIndex = array();
     // determine which items to index with this run
     $indexQueueItemRecords = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tx_solr_indexqueue_item', 'root = ' . $site->getRootPageId() . ' AND changed > indexed' . ' AND changed <= ' . time() . ' AND errors = \'\'', '', 'indexing_priority DESC, changed DESC, uid DESC', intval($limit));
     if (!empty($indexQueueItemRecords)) {
         // convert queued records to index queue item objects
         $itemsToIndex = $this->getIndexQueueItemObjectsFromRecords($indexQueueItemRecords);
     }
     return $itemsToIndex;
 }
开发者ID:nxpthx,项目名称:ext-solr,代码行数:18,代码来源:Queue.php


示例20: validateAdditionalFields

 /**
  * Checks any additional data that is relevant to this task. If the task
  * class is not relevant, the method is expected to return TRUE
  *
  * @param array $submittedData reference to the array containing the data submitted by the user
  * @param SchedulerModuleController $schedulerModule reference to the calling object (Scheduler's BE module)
  * @return bool True if validation was ok (or selected class is not relevant), FALSE otherwise
  */
 public function validateAdditionalFields(array &$submittedData, SchedulerModuleController $schedulerModule)
 {
     $result = false;
     // validate site
     $sites = Site::getAvailableSites();
     if (array_key_exists($submittedData['site'], $sites)) {
         $result = true;
     }
     return $result;
 }
开发者ID:sitegeist,项目名称:ext-solr,代码行数:18,代码来源:ReIndexTaskAdditionalFieldProvider.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Solr\Util类代码示例发布时间:2022-05-23
下一篇:
PHP Table\TableBuilder类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap