idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
36,800
protected function addAccessField ( Document $ document , Rootline $ pageAccessRootline ) { $ access = ( string ) $ pageAccessRootline ; if ( trim ( $ access ) !== '' ) { $ document -> setField ( 'access' , $ access ) ; } }
Adds the access field to the document if needed .
36,801
protected function addKeywordsField ( Document $ document , $ pageRecord ) { if ( ! isset ( $ pageRecord [ 'keywords' ] ) ) { return ; } $ keywords = array_unique ( GeneralUtility :: trimExplode ( ',' , $ pageRecord [ 'keywords' ] , true ) ) ; foreach ( $ keywords as $ keyword ) { $ document -> addField ( 'keywords' , ...
Adds keywords multi valued .
36,802
protected function addTagContentFields ( Document $ document , $ tagContent = [ ] ) { foreach ( $ tagContent as $ fieldName => $ fieldValue ) { $ document -> setField ( $ fieldName , $ fieldValue ) ; } }
Add content from several tags like headers anchors ...
36,803
public function modifyQuery ( Query $ query ) { $ query = $ this -> queryBuilder -> startFrom ( $ query ) -> useElevationFromTypoScript ( ) -> getQuery ( ) ; return $ query ; }
Enables the query s elevation mode .
36,804
protected function buildSolrHierarchyFromIdRootline ( array $ idRootline ) { $ hierarchy = [ ] ; $ depth = 0 ; $ currentPath = array_shift ( $ idRootline ) ; if ( is_null ( $ currentPath ) ) { return $ hierarchy ; } foreach ( $ idRootline as $ uid ) { $ hierarchy [ ] = $ depth . '-' . $ currentPath . '/' ; $ depth ++ ;...
Builds a Solr hierarchy from an array of uids that make up a rootline .
36,805
public function getLastIndexTime ( $ rootPageId ) { $ lastIndexTime = 0 ; $ lastIndexedRow = $ this -> queueItemRepository -> findLastIndexedRow ( $ rootPageId ) ; if ( $ lastIndexedRow [ 0 ] [ 'indexed' ] ) { $ lastIndexTime = $ lastIndexedRow [ 0 ] [ 'indexed' ] ; } return $ lastIndexTime ; }
Returns the timestamp of the last indexing run .
36,806
public function getLastIndexedItemId ( $ rootPageId ) { $ lastIndexedItemId = 0 ; $ lastIndexedItemRow = $ this -> queueItemRepository -> findLastIndexedRow ( $ rootPageId ) ; if ( $ lastIndexedItemRow [ 0 ] [ 'uid' ] ) { $ lastIndexedItemId = $ lastIndexedItemRow [ 0 ] [ 'uid' ] ; } return $ lastIndexedItemId ; }
Returns the uid of the last indexed item in the queue
36,807
protected function updateOrAddItemForAllRelatedRootPages ( $ itemType , $ itemUid , $ forcedChangeTime ) : int { $ updateCount = 0 ; $ rootPageIds = $ this -> rootPageResolver -> getResponsibleRootPageIds ( $ itemType , $ itemUid ) ; foreach ( $ rootPageIds as $ rootPageId ) { $ skipInvalidRootPage = $ rootPageId === 0...
Updates or add s the item for all relevant root pages .
36,808
protected function postProcessIndexQueueUpdateItem ( $ itemType , $ itemUid , $ updateCount , $ forcedChangeTime = 0 ) { if ( ! is_array ( $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'EXTCONF' ] [ 'solr' ] [ 'postProcessIndexQueueUpdateItem' ] ) ) { return $ updateCount ; } foreach ( $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'EXTCONF' ]...
Executes the updateItem post processing hook .
36,809
protected function getRecordCached ( $ itemType , $ itemUid , $ additionalRecordFields ) { $ cache = GeneralUtility :: makeInstance ( TwoLevelCache :: class , 'cache_runtime' ) ; $ cacheId = md5 ( 'Queue' . ':' . 'getRecordCached' . ':' . $ itemType . ':' . $ itemUid . ':' . 'pid' . $ additionalRecordFields ) ; $ recor...
Get record to be added in addNewItem
36,810
protected function getItemChangedTime ( $ itemType , $ itemUid ) { $ itemTypeHasStartTimeColumn = false ; $ changedTimeColumns = $ GLOBALS [ 'TCA' ] [ $ itemType ] [ 'ctrl' ] [ 'tstamp' ] ; $ startTime = 0 ; $ pageChangedTime = 0 ; if ( ! empty ( $ GLOBALS [ 'TCA' ] [ $ itemType ] [ 'ctrl' ] [ 'enablecolumns' ] [ 'star...
Determines the time for when an item should be indexed . This timestamp is then stored in the changed column in the Index Queue .
36,811
public static function cleanContent ( $ content ) { $ content = self :: stripControlCharacters ( $ content ) ; $ content = preg_replace ( '@<script[^>]*>.*?<\/script>@msi' , '' , $ content ) ; $ content = preg_replace ( '@<style[^>]*>.*?<\/style>@msi' , '' , $ content ) ; $ content = str_replace ( [ '<' , '>' ] , [ ' <...
Strips html tags and tab new - line carriage - return &nbsp ; whitespace characters .
36,812
public static function stripUnicodeRanges ( $ content ) { foreach ( self :: $ stripUnicodeRanges as $ range ) { $ content = self :: stripUnicodeRange ( $ content , $ range [ 0 ] , $ range [ 1 ] ) ; } return $ content ; }
Strips unusable unicode ranges
36,813
public function getTagContent ( ) { $ result = [ ] ; $ matches = [ ] ; $ content = $ this -> getContentMarkedForIndexing ( ) ; $ content = strip_tags ( $ content , '<' . implode ( '><' , array_keys ( $ this -> tagToFieldMapping ) ) . '>' ) ; preg_match_all ( '@<(' . implode ( '|' , array_keys ( $ this -> tagToFieldMapp...
Extracts HTML tag content from tags in the content marked for indexing .
36,814
public function removeByRootPidAndIndexQueueUid ( int $ rootPid , int $ indexQueueUid ) : int { $ queryBuider = $ this -> getQueryBuilder ( ) ; return $ queryBuider -> delete ( $ this -> table ) -> where ( $ queryBuider -> expr ( ) -> eq ( 'root' , $ queryBuider -> createNamedParameter ( $ rootPid , \ PDO :: PARAM_INT ...
Removes existing indexing properties .
36,815
public function bulkInsert ( array $ properties ) : int { return $ this -> getQueryBuilder ( ) -> getConnection ( ) -> bulkInsert ( $ this -> table , $ properties , [ 'root' , 'item_id' , 'property_key' , 'property_value' ] ) ; }
Inserts a list of given properties
36,816
public function findAllByIndexQueueUid ( int $ indexQueueUid ) : array { $ queryBuider = $ this -> getQueryBuilder ( ) ; return $ queryBuider -> select ( 'property_key' , 'property_value' ) -> from ( $ this -> table ) -> where ( $ queryBuider -> expr ( ) -> eq ( 'item_id' , $ queryBuider -> createNamedParameter ( $ ind...
Fetches a list of properties related to index queue item
36,817
protected function initializeAction ( ) { parent :: initializeAction ( ) ; $ this -> solrConnectionManager = GeneralUtility :: makeInstance ( ConnectionManager :: class ) ; $ this -> moduleDataStorageService = GeneralUtility :: makeInstance ( ModuleDataStorageService :: class ) ; $ this -> selectedPageUID = ( int ) Gen...
Initializes the controller and sets needed vars .
36,818
public function generateCoreSelectorMenuUsingPageTree ( string $ uriToRedirectTo = null ) { if ( $ this -> selectedPageUID < 1 || null === $ this -> selectedSite ) { return ; } if ( $ this -> view instanceof NotFoundView ) { $ this -> initializeSelectedSolrCoreConnection ( ) ; return ; } $ this -> generateCoreSelectorM...
Generates selector menu in backends doc header using selected page from page tree .
36,819
protected function generateCoreSelectorMenu ( Site $ site , string $ uriToRedirectTo = null ) { if ( ! $ this -> view instanceof BackendTemplateView ) { throw new InvalidViewObjectNameException ( vsprintf ( 'The controller "%s" must use BackendTemplateView to be able to generate menu for backends docheader. \ ...
Generates Core selector Menu for given Site .
36,820
public function switchCoreAction ( string $ corePath , string $ uriToRedirectTo ) { $ moduleData = $ this -> moduleDataStorageService -> loadModuleData ( ) ; $ moduleData -> setCore ( $ corePath ) ; $ this -> moduleDataStorageService -> persistModuleData ( $ moduleData ) ; $ message = LocalizationUtility :: translate (...
Switches used core .
36,821
private function initializeSelectedSolrCoreConnection ( ) { $ moduleData = $ this -> moduleDataStorageService -> loadModuleData ( ) ; $ solrCoreConnections = $ this -> solrConnectionManager -> getConnectionsBySite ( $ this -> selectedSite ) ; $ currentSolrCorePath = $ moduleData -> getCore ( ) ; if ( empty ( $ currentS...
Initializes the solr core connection considerately to the components state . Uses and persists default core connection if persisted core in Site does not exist .
36,822
public function search ( $ query ) { try { $ request = $ this -> client -> createRequest ( $ query ) ; $ response = $ this -> executeRequest ( $ request ) ; $ this -> hasSearched = true ; $ this -> responseCache = $ response ; } catch ( HttpException $ e ) { $ this -> handleErrorResponses ( $ e ) ; } return $ response ...
Performs a search .
36,823
protected function handleErrorResponses ( HttpException $ exception ) { $ status = $ exception -> getCode ( ) ; $ message = $ exception -> getStatusMessage ( ) ; $ solrRespone = new ResponseAdapter ( $ exception -> getBody ( ) ) ; if ( $ status === 0 || $ status === 502 ) { $ e = new SolrUnavailableException ( 'Solr Se...
This method maps the failed solr requests to a meaningful exception .
36,824
public function indexItems ( $ limit ) { $ errors = 0 ; $ indexRunId = uniqid ( ) ; $ configurationToUse = $ this -> site -> getSolrConfiguration ( ) ; $ enableCommitsSetting = $ configurationToUse -> getEnableCommits ( ) ; $ itemsToIndex = $ this -> indexQueue -> getItemsToIndex ( $ this -> site , $ limit ) ; $ this -...
Indexes items from the Index Queue .
36,825
protected function generateIndexingErrorLog ( Item $ itemToIndex , \ Exception $ e ) { $ message = 'Failed indexing Index Queue item ' . $ itemToIndex -> getIndexQueueUid ( ) ; $ data = [ 'code' => $ e -> getCode ( ) , 'message' => $ e -> getMessage ( ) , 'trace' => $ e -> getTraceAsString ( ) , 'item' => ( array ) $ i...
Generates a message in the error log when an error occured .
36,826
protected function indexItem ( Item $ item , TypoScriptConfiguration $ configuration ) { $ indexer = $ this -> getIndexerByItem ( $ item -> getIndexingConfigurationName ( ) , $ configuration ) ; $ originalHttpHost = isset ( $ _SERVER [ 'HTTP_HOST' ] ) ? $ _SERVER [ 'HTTP_HOST' ] : null ; $ itemChangedDate = $ item -> g...
Indexes an item from the Index Queue .
36,827
protected function getIndexerByItem ( $ indexingConfigurationName , TypoScriptConfiguration $ configuration ) { $ indexerClass = $ configuration -> getIndexQueueIndexerByConfigurationName ( $ indexingConfigurationName ) ; $ indexerConfiguration = $ configuration -> getIndexQueueIndexerConfigurationByConfigurationName (...
A factory method to get an indexer depending on an item s configuration .
36,828
protected function getFromFirstLevelCache ( $ cacheId ) { if ( ! empty ( self :: $ firstLevelCache [ $ this -> cacheName ] [ $ cacheId ] ) ) { return self :: $ firstLevelCache [ $ this -> cacheName ] [ $ cacheId ] ; } return null ; }
Retrieves a value from the first level cache .
36,829
public function get ( $ cacheId ) { $ firstLevelResult = $ this -> getFromFirstLevelCache ( $ cacheId ) ; if ( $ firstLevelResult !== null ) { return $ firstLevelResult ; } return $ this -> secondLevelCache -> get ( $ cacheId ) ; }
Retrieves a value from the first level cache if present and from the second level if not .
36,830
public function set ( $ cacheId , $ value ) { $ this -> setToFirstLevelCache ( $ cacheId , $ value ) ; $ this -> secondLevelCache -> set ( $ cacheId , $ value ) ; }
Write a value to the first and second level cache .
36,831
protected function getRenderedReport ( $ templateFilename = '' , $ variables = [ ] ) { $ templatePath = 'EXT:solr/Resources/Private/Templates/Backend/Reports/' . $ templateFilename ; $ standaloneView = $ this -> getFluidStandaloneViewWithTemplate ( $ templatePath ) ; $ standaloneView -> assignMultiple ( $ variables ) ;...
Assigns variables to the fluid StandaloneView and renders the view .
36,832
private function getFluidStandaloneViewWithTemplate ( $ templatePath = '' ) { $ standaloneView = GeneralUtility :: makeInstance ( StandaloneView :: class ) ; $ standaloneView -> setTemplatePathAndFilename ( GeneralUtility :: getFileAbsFileName ( $ templatePath ) ) ; return $ standaloneView ; }
Initializes a StandaloneView with a template and returns it .
36,833
public function getStatus ( ) { $ reports = [ ] ; $ rootPageFlagStatus = $ this -> getRootPageFlagStatus ( ) ; if ( ! is_null ( $ rootPageFlagStatus ) ) { $ reports [ ] = $ rootPageFlagStatus ; return $ reports ; } $ domainRecordAvailableStatus = $ this -> getDomainRecordAvailableStatus ( ) ; if ( ! is_null ( $ domainR...
Compiles a collection of configuration status checks .
36,834
protected function getRootPageFlagStatus ( ) { $ rootPages = $ this -> getRootPages ( ) ; if ( ! empty ( $ rootPages ) ) { return null ; } $ report = $ this -> getRenderedReport ( 'RootPageFlagStatus.html' ) ; return GeneralUtility :: makeInstance ( Status :: class , 'Sites' , 'No sites found' , $ report , Status :: ER...
Checks whether the Use as Root Page page property has been set for any site .
36,835
protected function getConfigIndexEnableStatus ( ) { $ rootPagesWithIndexingOff = $ this -> getRootPagesWithIndexingOff ( ) ; if ( empty ( $ rootPagesWithIndexingOff ) ) { return null ; } $ report = $ this -> getRenderedReport ( 'SolrConfigurationStatusIndexing.html' , [ 'pages' => $ rootPagesWithIndexingOff ] ) ; retur...
Checks whether config . index_enable is set to 1 otherwise indexing will not work .
36,836
protected function getRootPagesWithoutDomain ( ) { $ rootPagesWithoutDomain = [ ] ; $ rootPages = $ this -> getRootPages ( ) ; $ rootPageIds = [ ] ; foreach ( $ rootPages as $ rootPage ) { $ rootPageIds [ ] = $ rootPage [ 'uid' ] ; } $ domainRecords = $ this -> systemDomainRepository -> findDomainRecordsByRootPagesIds ...
Returns an array of rootPages without an existing domain record .
36,837
protected function getIsSolrEnabled ( ) { if ( empty ( $ GLOBALS [ 'TSFE' ] -> tmpl -> setup [ 'plugin.' ] [ 'tx_solr.' ] [ 'enabled' ] ) ) { return false ; } return ( bool ) $ GLOBALS [ 'TSFE' ] -> tmpl -> setup [ 'plugin.' ] [ 'tx_solr.' ] [ 'enabled' ] ; }
Checks if the solr plugin is enabled with plugin . tx_solr . enabled .
36,838
public function decode ( $ dateRange , array $ configuration = [ ] ) { list ( $ dateRangeStart , $ dateRangeEnd ) = explode ( self :: DELIMITER , $ dateRange ) ; $ formatService = GeneralUtility :: makeInstance ( FormatService :: class ) ; $ fromPart = '*' ; if ( $ dateRangeStart !== '' ) { $ fromPart = $ formatService...
Parses the given date range from a GET parameter and returns a Solr date range filter .
36,839
public function suggestAction ( $ queryString , $ callback , $ additionalFilters = [ ] ) { $ jsonPCallback = htmlspecialchars ( $ callback ) ; $ rawQuery = htmlspecialchars ( mb_strtolower ( trim ( $ queryString ) ) ) ; try { $ suggestService = GeneralUtility :: makeInstance ( SuggestService :: class , $ this -> typoSc...
This method creates a suggest json response that can be used in a suggest layer .
36,840
public function removeGarbageOf ( $ table , $ uid ) { $ this -> removeGarbageOfByStrategy ( $ table , $ uid ) ; $ this -> callPostProcessGarbageCollectorHook ( $ table , $ uid ) ; }
Call s the removal of the strategy and afterwards the garbagecollector post processing hook .
36,841
protected function deleteInSolrAndRemoveFromIndexQueue ( $ table , $ uid ) { $ this -> deleteIndexDocuments ( $ table , $ uid ) ; $ this -> queue -> deleteItem ( $ table , $ uid ) ; }
Deletes a document from solr and from the index queue .
36,842
protected function deleteIndexDocuments ( $ table , $ uid ) { $ indexQueueItems = $ this -> queue -> getItems ( $ table , $ uid ) ; foreach ( $ indexQueueItems as $ indexQueueItem ) { $ site = $ indexQueueItem -> getSite ( ) ; $ enableCommitsSetting = $ site -> getSolrConfiguration ( ) -> getEnableCommits ( ) ; $ siteH...
Deletes index documents for a given record identification .
36,843
protected function deleteRecordInAllSolrConnections ( $ table , $ uid , $ solrConnections , $ siteHash , $ enableCommitsSetting ) { foreach ( $ solrConnections as $ solr ) { $ solr -> getWriteService ( ) -> deleteByQuery ( 'type:' . $ table . ' AND uid:' . ( int ) $ uid . ' AND siteHash:' . $ siteHash ) ; if ( $ enable...
Deletes the record in all solr connections from that site .
36,844
protected function callPostProcessGarbageCollectorHook ( $ table , $ uid ) { if ( ! is_array ( $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'EXTCONF' ] [ 'solr' ] [ 'postProcessGarbageCollector' ] ) ) { return ; } foreach ( $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'EXTCONF' ] [ 'solr' ] [ 'postProcessGarbageCollector' ] as $ classRefere...
Calls the registered post processing hooks after the garbageCollection .
36,845
public function initializeBySitesAndConfigurations ( array $ sites , array $ indexingConfigurationNames = [ '*' ] ) : array { $ initializationStatesBySiteId = [ ] ; foreach ( $ sites as $ site ) { $ initializationResult = $ this -> initializeBySiteAndIndexConfigurations ( $ site , $ indexingConfigurationNames ) ; $ ini...
Truncates and rebuilds the tx_solr_indexqueue_item table for a set of sites and a set of index configurations .
36,846
public function initializeBySiteAndIndexConfigurations ( Site $ site , array $ indexingConfigurationNames ) : array { $ initializationStatus = [ ] ; $ hasWildcardConfiguration = in_array ( '*' , $ indexingConfigurationNames ) ; $ indexingConfigurationNames = $ hasWildcardConfiguration ? $ site -> getSolrConfiguration (...
Initializes a set index configurations for a given site .
36,847
protected function applyInitialization ( Site $ site , $ indexingConfigurationName ) : bool { $ this -> queue -> deleteItemsBySite ( $ site , $ indexingConfigurationName ) ; $ solrConfiguration = $ site -> getSolrConfiguration ( ) ; $ tableToIndex = $ solrConfiguration -> getIndexQueueTableNameOrFallbackToConfiguration...
Initializes the Index Queue for a specific indexing configuration .
36,848
public function getRenderedScores ( $ solrDebugData , $ queryFields ) { $ highScores = $ this -> parseScores ( $ solrDebugData , $ queryFields ) ; return $ this -> render ( $ highScores ) ; }
Renders an overview of how the score for a certain document has been calculated .
36,849
public function render ( array $ highScores ) { $ scores = [ ] ; $ totalScore = 0 ; foreach ( $ highScores as $ highScore ) { $ scores [ ] = ' <td>+ ' . htmlspecialchars ( $ highScore -> getScore ( ) ) . '</td> <td>' . htmlspecialchars ( $ highScore -> getFieldName ( ) ) . '</td> <td>' . htmlspecialchars ( $ h...
Renders an array of score objects into an score output .
36,850
public function parseScores ( $ debugData , $ queryFields ) { $ highScores = [ ] ; $ pattern = '/(.*) = weight\(([^ \)]*)/' ; $ scoreMatches = [ ] ; preg_match_all ( $ pattern , $ debugData , $ scoreMatches ) ; foreach ( $ scoreMatches [ 0 ] as $ key => $ value ) { list ( $ field , $ searchTerm ) = explode ( ':' , $ sc...
Parses the debugData and the queryFields into an array of score objects .
36,851
public function getOverlay ( $ tableName , $ record ) { if ( $ tableName === 'pages' ) { return $ this -> tsfe -> sys_page -> getPageOverlay ( $ record , $ this -> tsfe -> sys_language_uid ) ; } return $ this -> tsfe -> sys_page -> getRecordOverlay ( $ tableName , $ record , $ this -> tsfe -> sys_language_uid ) ; }
Return the translated record
36,852
public function getUidOfOverlay ( $ table , $ field , $ uid ) { if ( ! isset ( $ this -> tsfe -> sys_language_uid ) ) { return $ uid ; } if ( ! $ this -> tsfe -> sys_language_uid > 0 ) { return $ uid ; } $ record = $ this -> getRecord ( $ table , $ uid ) ; if ( ! is_array ( $ record ) ) { return $ uid ; } $ overlayUid ...
When the record has an overlay we retrieve the uid of the translated record to resolve the relations from the translation .
36,853
protected function getLocalRecordUidFromOverlay ( $ localTableName , $ originalRecord ) { $ overlayRecord = $ this -> getOverlay ( $ localTableName , $ originalRecord ) ; if ( $ localTableName === 'pages' && isset ( $ overlayRecord [ '_PAGES_OVERLAY_UID' ] ) ) { return ( int ) $ overlayRecord [ '_PAGES_OVERLAY_UID' ] ;...
This method retrieves the _PAGES_OVERLAY_UID or _LOCALIZED_UID from the localized record .
36,854
public function getFacetFieldsFromSchema ( array & $ parentInformation ) { $ pageRecord = $ parentInformation [ 'flexParentDatabaseRow' ] ; $ configuredFacets = $ this -> getConfiguredFacetsForPage ( $ pageRecord [ 'pid' ] ) ; if ( ! is_array ( $ pageRecord ) ) { $ parentInformation [ 'items' ] = [ ] ; return ; } $ new...
Provides all facet fields for a flexform select enabling the editor to select one of them .
36,855
protected function getParsedSolrFieldsFromSchema ( $ configuredFacets , $ pageRecord ) { $ newItems = [ ] ; array_map ( function ( $ fieldName ) use ( & $ newItems , $ configuredFacets ) { $ value = $ fieldName ; $ label = $ fieldName ; $ facetNameFilter = function ( $ facet ) use ( $ fieldName ) { return ( $ facet [ '...
This method parses the solr schema fields into the required format for the backend flexform .
36,856
protected function getAvailableTemplateFromTypoScriptConfiguration ( $ pageId , $ templateKey ) { $ configuration = $ this -> getConfigurationFromPageId ( $ pageId ) ; return $ configuration -> getAvailableTemplatesByFileKey ( $ templateKey ) ; }
Retrieves the configured templates from TypoScript .
36,857
protected function buildSelectItemsFromAvailableTemplate ( $ availableTemplates ) { $ newItems = [ ] ; $ newItems [ 'Use Default' ] = [ 'Use Default' , null ] ; foreach ( $ availableTemplates as $ availableTemplate ) { $ label = isset ( $ availableTemplate [ 'label' ] ) ? $ availableTemplate [ 'label' ] : '' ; $ value ...
Returns the available templates as needed for the flexform .
36,858
public function mergeArguments ( array $ argumentsToMerge ) { ArrayUtility :: mergeRecursiveWithOverrule ( $ this -> persistedArguments , $ argumentsToMerge ) ; $ this -> reset ( ) ; return $ this ; }
Can be used do merge arguments into the request arguments
36,859
public function getActiveFacetValuesByName ( $ facetName ) { $ values = [ ] ; $ activeFacets = $ this -> getActiveFacets ( ) ; array_map ( function ( $ activeFacet ) use ( & $ values , $ facetName ) { $ parts = explode ( ':' , $ activeFacet , 2 ) ; if ( $ parts [ 0 ] === $ facetName ) { $ values [ ] = $ parts [ 1 ] ; }...
Returns all facet values for a certain facetName
36,860
public function addFacetValue ( $ facetName , $ facetValue ) { if ( $ this -> getHasFacetValue ( $ facetName , $ facetValue ) ) { return $ this ; } $ facetValues = $ this -> getActiveFacets ( ) ; $ facetValues [ ] = $ facetName . ':' . $ facetValue ; $ this -> setActiveFacets ( $ facetValues ) ; $ this -> stateChanged ...
Adds a facet value to the request .
36,861
public function removeFacetValue ( $ facetName , $ facetValue ) { if ( ! $ this -> getHasFacetValue ( $ facetName , $ facetValue ) ) { return $ this ; } $ facetValues = $ this -> getActiveFacets ( ) ; $ facetValueToLookFor = $ facetName . ':' . $ facetValue ; foreach ( $ facetValues as $ index => $ facetValue ) { if ( ...
Removes a facet value from the request .
36,862
public function removeAllFacetValuesByName ( $ facetName ) { $ facetValues = $ this -> getActiveFacets ( ) ; $ facetValues = array_filter ( $ facetValues , function ( $ facetValue ) use ( $ facetName ) { $ parts = explode ( ':' , $ facetValue , 2 ) ; return $ parts [ 0 ] !== $ facetName ; } ) ; $ this -> setActiveFacet...
Removes all facet values from the request by a certain facet name
36,863
public function removeAllFacets ( ) { $ path = $ this -> prefixWithNamespace ( 'filter' ) ; $ this -> argumentsAccessor -> reset ( $ path ) ; $ this -> stateChanged = true ; return $ this ; }
Removes all active facets from the request .
36,864
protected function getSortingPart ( $ index ) { $ sorting = $ this -> getSorting ( ) ; if ( $ sorting === '' ) { return null ; } $ parts = explode ( ' ' , $ sorting ) ; return isset ( $ parts [ $ index ] ) ? $ parts [ $ index ] : null ; }
Helper function to get the sorting configuration name or direction .
36,865
public function setPage ( $ page ) { $ this -> stateChanged = true ; $ path = $ this -> prefixWithNamespace ( 'page' ) ; $ this -> argumentsAccessor -> set ( $ path , $ page ) ; return $ this ; }
Method to set the paginated page of the search
36,866
public function removeAllGroupItemPages ( ) : SearchRequest { $ path = $ this -> prefixWithNamespace ( 'groupPage' ) ; $ this -> argumentsAccessor -> reset ( $ path ) ; return $ this ; }
Can be used to reset all groupPages .
36,867
public function setGroupItemPage ( string $ groupName , string $ groupItemValue , int $ page ) : SearchRequest { $ this -> stateChanged = true ; $ escapedValue = $ this -> getEscapedGroupItemValue ( $ groupItemValue ) ; $ path = $ this -> prefixWithNamespace ( 'groupPage:' . $ groupName . ':' . $ escapedValue ) ; $ thi...
Can be used to paginate within a groupItem .
36,868
public function getGroupItemPage ( string $ groupName , string $ groupItemValue ) : int { $ escapedValue = $ this -> getEscapedGroupItemValue ( $ groupItemValue ) ; $ path = $ this -> prefixWithNamespace ( 'groupPage:' . $ groupName . ':' . $ escapedValue ) ; return max ( 1 , ( int ) $ this -> argumentsAccessor -> get ...
Retrieves the current page for this group item .
36,869
public function getHighestGroupPage ( ) { $ max = 1 ; $ path = $ this -> prefixWithNamespace ( 'groupPage' ) ; $ groupPages = $ this -> argumentsAccessor -> get ( $ path , [ ] ) ; foreach ( $ groupPages as $ groups ) { if ( ! is_array ( $ groups ) ) continue ; foreach ( $ groups as $ groupItemPage ) { if ( $ groupItemP...
Retrieves the highest page of the groups .
36,870
public function setRawQueryString ( $ rawQueryString ) { $ this -> stateChanged = true ; $ path = $ this -> prefixWithNamespace ( 'q' ) ; $ this -> argumentsAccessor -> set ( $ path , $ rawQueryString ) ; return $ this ; }
Method to overwrite the query string .
36,871
public function getRawUserQuery ( ) { $ path = $ this -> prefixWithNamespace ( 'q' ) ; $ query = $ this -> argumentsAccessor -> get ( $ path , null ) ; return is_null ( $ query ) ? $ query : ( string ) $ query ; }
Returns the passed rawQueryString .
36,872
public function getRawUserQueryIsNull ( ) { $ path = $ this -> prefixWithNamespace ( 'q' ) ; $ query = $ this -> argumentsAccessor -> get ( $ path , null ) ; return $ query === null ; }
This method returns true when no querystring is present at all . Which means no search by the user was triggered
36,873
public function setResultsPerPage ( $ resultsPerPage ) { $ path = $ this -> prefixWithNamespace ( 'resultsPerPage' ) ; $ this -> argumentsAccessor -> set ( $ path , $ resultsPerPage ) ; $ this -> stateChanged = true ; return $ this ; }
Sets the results per page that are used during search .
36,874
public function setAdditionalFilters ( $ additionalFilters ) { $ path = $ this -> prefixWithNamespace ( 'additionalFilters' ) ; $ this -> argumentsAccessor -> set ( $ path , $ additionalFilters ) ; $ this -> stateChanged = true ; return $ this ; }
Allows to set additional filters that are used on time and not transported during the request .
36,875
public function reset ( ) { $ this -> argumentsAccessor = new ArrayAccessor ( $ this -> persistedArguments ) ; $ this -> stateChanged = false ; return $ this ; }
Assigns the last known persistedArguments and restores their state .
36,876
protected function calculateDisplayRange ( ) { $ maximumNumberOfLinks = $ this -> maximumNumberOfLinks ; if ( $ maximumNumberOfLinks > $ this -> numberOfPages ) { $ maximumNumberOfLinks = $ this -> numberOfPages ; } $ delta = floor ( $ maximumNumberOfLinks / 2 ) ; $ this -> displayRangeStart = $ this -> currentPage - $...
If a certain number of links should be displayed adjust before and after amounts accordingly .
36,877
public function updateConnection ( ServerRequestInterface $ request , ResponseInterface $ response ) : ResponseInterface { $ queryParams = $ request -> getQueryParams ( ) ; $ pageId = 0 ; if ( isset ( $ queryParams [ 'id' ] ) ) { $ pageId = ( int ) $ queryParams [ 'id' ] ; } $ content = [ 'success' => true , 'message' ...
Update a single solr connection
36,878
public function updateConnections ( ServerRequestInterface $ request ) : ResponseInterface { $ connectionManager = GeneralUtility :: makeInstance ( ConnectionManager :: class ) ; $ connectionManager -> updateConnections ( ) ; return new Response ( ) ; }
Update all connections
36,879
protected function getAdditionalFields ( ) { $ additionalFields = [ ] ; foreach ( $ this -> additionalFieldNames as $ additionalFieldName ) { $ additionalFields [ $ additionalFieldName ] = $ this -> getFieldValue ( $ additionalFieldName ) ; } return $ additionalFields ; }
Gets the additional fields as an array mapping field names to values .
36,880
public function collectGarbage ( $ table , $ uid ) { $ garbageRemoverStrategy = StrategyFactory :: getByTable ( $ table ) ; $ garbageRemoverStrategy -> removeGarbageOf ( $ table , $ uid ) ; }
Tracks down index documents belonging to a particular record or page and removes them from the index and the Index Queue .
36,881
public function processCmdmap_postProcess ( $ command , $ table , $ uid , $ value , DataHandler $ tceMain ) { if ( $ command === 'move' && $ table === 'pages' && $ GLOBALS [ 'BE_USER' ] -> workspace == 0 ) { $ this -> collectGarbage ( $ table , $ uid ) ; $ this -> getIndexQueue ( ) -> updateItem ( $ table , $ uid ) ; }...
Hooks into TCE main and tracks page move commands .
36,882
public function processDatamap_preProcessFieldArray ( $ incomingFields , $ table , $ uid , DataHandler $ tceMain ) { if ( ! is_int ( $ uid ) ) { return ; } if ( Util :: isDraftRecord ( $ table , $ uid ) ) { return ; } $ hasConfiguredEnableColumnForFeGroup = $ this -> tcaService -> isEnableColumn ( $ table , 'fe_group' ...
Hooks into TCE main and tracks changed records . In this case the current record s values are stored to do a change comparison later on for fields like fe_group .
36,883
public function processDatamap_afterDatabaseOperations ( $ status , $ table , $ uid , array $ fields , DataHandler $ tceMain ) { if ( $ status === 'new' ) { return ; } if ( Util :: isDraftRecord ( $ table , $ uid ) ) { return ; } $ record = $ this -> getRecordWithFieldRelevantForGarbageCollection ( $ table , $ uid ) ; ...
Hooks into TCE Main and watches all record updates . If a change is detected that would remove the record from the website we try to find related documents and remove them from the index .
36,884
protected function isInvisibleByStartOrEndtime ( $ table , $ record ) { return ( ( $ this -> tcaService -> isStartTimeInFuture ( $ table , $ record ) || $ this -> tcaService -> isEndTimeInPast ( $ table , $ record ) ) && $ this -> isRelatedQueueRecordMarkedAsIndexed ( $ table , $ record ) ) ; }
Check if a record is getting invisible due to changes in start or endtime . In addition it is checked that the related queue item was marked as indexed .
36,885
protected function isRelatedQueueRecordMarkedAsIndexed ( $ table , $ record ) { if ( $ table === 'tt_content' ) { $ table = 'pages' ; $ uid = $ record [ 'pid' ] ; } else { $ uid = $ record [ 'uid' ] ; } return $ this -> getIndexQueue ( ) -> containsIndexedItem ( $ table , $ uid ) ; }
Checks if the related index queue item is indexed .
36,886
protected function hasFrontendGroupsRemoved ( $ table , $ record ) { if ( ! isset ( $ GLOBALS [ 'TCA' ] [ $ table ] [ 'ctrl' ] [ 'enablecolumns' ] [ 'fe_group' ] ) ) { return false ; } $ frontendGroupsField = $ GLOBALS [ 'TCA' ] [ $ table ] [ 'ctrl' ] [ 'enablecolumns' ] [ 'fe_group' ] ; $ previousGroups = explode ( ',...
Checks whether the a frontend group field exists for the record and if so whether groups have been removed from accessing the record thus making the record invisible to at least some people .
36,887
protected function getIsGarbageRecord ( $ table , $ record ) : bool { return $ this -> tcaService -> isHidden ( $ table , $ record ) || $ this -> isInvisibleByStartOrEndtime ( $ table , $ record ) || $ this -> hasFrontendGroupsRemoved ( $ table , $ record ) || ( $ table === 'pages' && $ this -> isPageExcludedFromSearch...
Determines if a record is garbage and can be deleted .
36,888
protected function getRecordWithFieldRelevantForGarbageCollection ( $ table , $ uid ) : array { $ garbageCollectionRelevantFields = $ this -> tcaService -> getVisibilityAffectingFieldsByTable ( $ table ) ; $ record = ( array ) BackendUtility :: getRecord ( $ table , $ uid , $ garbageCollectionRelevantFields , '' , fals...
Returns a record with all visibility affecting fields .
36,889
protected function getPathAsArray ( $ path ) { $ path = str_replace ( '\/' , '@@@' , $ path ) ; $ path = rtrim ( $ path , "/" ) ; $ segments = explode ( '/' , $ path ) ; return array_map ( function ( $ item ) { return str_replace ( '@@@' , '/' , $ item ) ; } , $ segments ) ; }
This method is used to get the path array from a hierarchical facet . It substitutes escaped slashes to keep them when they are used inside a facetValue .
36,890
public function applyHtmlSpecialCharsOnAllFields ( array $ documents ) { $ trustedSolrFields = $ this -> typoScriptConfiguration -> getSearchTrustedFieldsArray ( ) ; foreach ( $ documents as $ key => $ document ) { $ fieldNames = array_keys ( $ document -> getFields ( ) ?? [ ] ) ; foreach ( $ fieldNames as $ fieldName ...
This method is used to apply htmlspecialchars on all document fields that are not configured to be secure . Secure mean that we know where the content is coming from .
36,891
protected function applyHtmlSpecialCharsOnSingleFieldValue ( $ fieldValue ) { if ( is_array ( $ fieldValue ) ) { foreach ( $ fieldValue as $ key => $ fieldValueItem ) { $ fieldValue [ $ key ] = htmlspecialchars ( $ fieldValueItem , null , null , false ) ; } } else { $ fieldValue = htmlspecialchars ( $ fieldValue , null...
Applies htmlspecialchars on all items of an array of a single value .
36,892
public function isEnabledRecord ( $ table , $ record ) { if ( ( empty ( $ record ) ) || ( isset ( $ this -> tca [ $ table ] [ 'ctrl' ] [ 'enablecolumns' ] [ 'disabled' ] ) && ! empty ( $ record [ $ this -> tca [ $ table ] [ 'ctrl' ] [ 'enablecolumns' ] [ 'disabled' ] ] ) ) || ( isset ( $ this -> tca [ $ table ] [ 'ctrl...
Checks if a record is enabled
36,893
public function isEndTimeInPast ( $ table , $ record ) { $ endTimeInPast = false ; if ( isset ( $ this -> tca [ $ table ] [ 'ctrl' ] [ 'enablecolumns' ] [ 'endtime' ] ) ) { $ endTimeField = $ this -> tca [ $ table ] [ 'ctrl' ] [ 'enablecolumns' ] [ 'endtime' ] ; if ( $ record [ $ endTimeField ] > 0 ) { $ endTimeInPast ...
Checks whether a end time field exists for the record s table and if so determines if a time is set and whether that time is in the past making the record invisible on the website .
36,894
public function isEnableColumn ( $ table , $ columnName ) { return ( isset ( $ GLOBALS [ 'TCA' ] [ $ table ] [ 'ctrl' ] [ 'enablecolumns' ] ) && array_key_exists ( $ columnName , $ GLOBALS [ 'TCA' ] [ $ table ] [ 'ctrl' ] [ 'enablecolumns' ] ) ) ; }
This method can be used to check if there is a configured key in
36,895
public function isStartTimeInFuture ( $ table , $ record ) { $ startTimeInFuture = false ; if ( isset ( $ this -> tca [ $ table ] [ 'ctrl' ] [ 'enablecolumns' ] [ 'starttime' ] ) ) { $ startTimeField = $ this -> tca [ $ table ] [ 'ctrl' ] [ 'enablecolumns' ] [ 'starttime' ] ; $ startTimeInFuture = $ record [ $ startTim...
Checks whether a start time field exists for the record s table and if so determines if a time is set and whether that time is in the future making the record invisible on the website .
36,896
public function isHidden ( $ table , $ record ) { $ hidden = false ; if ( isset ( $ this -> tca [ $ table ] [ 'ctrl' ] [ 'enablecolumns' ] [ 'disabled' ] ) ) { $ hiddenField = $ this -> tca [ $ table ] [ 'ctrl' ] [ 'enablecolumns' ] [ 'disabled' ] ; $ hidden = ( boolean ) $ record [ $ hiddenField ] ; } return $ hidden ...
Checks whether a hidden field exists for the current table and if so determines whether it is set on the current record .
36,897
public function normalizeFrontendGroupField ( $ table , $ record ) { if ( isset ( $ this -> tca [ $ table ] [ 'ctrl' ] [ 'enablecolumns' ] [ 'fe_group' ] ) ) { $ frontendGroupsField = $ this -> tca [ $ table ] [ 'ctrl' ] [ 'enablecolumns' ] [ 'fe_group' ] ; if ( $ record [ $ frontendGroupsField ] == '' ) { $ record [ $...
Makes sure that empty frontend group fields are always the same value .
36,898
public function getTranslationOriginalUidIfTranslated ( $ table , array $ record , $ originalUid ) { if ( ! $ this -> isLocalizedRecord ( $ table , $ record ) ) { return $ originalUid ; } return $ this -> getTranslationOriginalUid ( $ table , $ record ) ; }
Retrieves the uid that as marked as original if the record is a translation if not it returns the originalUid .
36,899
public function isLocalizedRecord ( $ tableName , array $ record ) { $ translationUid = $ this -> getTranslationOriginalUid ( $ tableName , $ record ) ; if ( is_null ( $ translationUid ) ) { return false ; } $ hasTranslationReference = $ translationUid > 0 ; if ( ! $ hasTranslationReference ) { return false ; } return ...
Checks whether a record is a localization overlay .