idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
37,200
public function findErrorsBySite ( Site $ site ) : array { $ queryBuilder = $ this -> getQueryBuilder ( ) ; $ errors = $ queryBuilder -> select ( 'uid' , 'item_type' , 'item_uid' , 'errors' ) -> from ( $ this -> table ) -> andWhere ( $ queryBuilder -> expr ( ) -> notLike ( 'errors' , $ queryBuilder -> createNamedParame...
Finds indexing errors for the current site
37,201
public function flushAllErrors ( ) : int { $ queryBuilder = $ this -> getQueryBuilder ( ) ; $ affectedRows = $ this -> getPreparedFlushErrorQuery ( $ queryBuilder ) -> execute ( ) ; return $ affectedRows ; }
Resets all the errors for all index queue items .
37,202
public function flushErrorsBySite ( Site $ site ) : int { $ queryBuilder = $ this -> getQueryBuilder ( ) ; $ affectedRows = $ this -> getPreparedFlushErrorQuery ( $ queryBuilder ) -> andWhere ( $ queryBuilder -> expr ( ) -> eq ( 'root' , ( int ) $ site -> getRootPageId ( ) ) ) -> execute ( ) ; return $ affectedRows ; }
Flushes the errors for a single site .
37,203
public function flushErrorByItem ( Item $ item ) : int { $ queryBuilder = $ this -> getQueryBuilder ( ) ; $ affectedRows = $ this -> getPreparedFlushErrorQuery ( $ queryBuilder ) -> andWhere ( $ queryBuilder -> expr ( ) -> eq ( 'uid' , $ item -> getIndexQueueUid ( ) ) ) -> execute ( ) ; return $ affectedRows ; }
Flushes the error for a single item .
37,204
private function getPreparedFlushErrorQuery ( QueryBuilder $ queryBuilder ) { return $ queryBuilder -> update ( $ this -> table ) -> set ( 'errors' , '' ) -> where ( $ queryBuilder -> expr ( ) -> notLike ( 'errors' , $ queryBuilder -> createNamedParameter ( '' ) ) ) ; }
Initializes the QueryBuilder with a query the resets the error field for items that have an error .
37,205
public function getLocalizableItemChangedTime ( string $ itemType , int $ itemUid ) : int { $ localizedChangedTime = 0 ; if ( $ itemType === 'pages' ) { $ itemType = 'pages_language_overlay' ; } if ( isset ( $ GLOBALS [ 'TCA' ] [ $ itemType ] [ 'ctrl' ] [ 'transOrigPointerField' ] ) ) { $ translationOriginalPointerFiel...
Gets the most recent changed time for an item taking into account localized records .
37,206
public function containsIndexedItem ( string $ itemType , int $ itemUid ) : bool { $ queryBuilder = $ this -> getQueryBuilderForContainsMethods ( $ itemType , $ itemUid ) ; return ( bool ) $ queryBuilder -> andWhere ( $ queryBuilder -> expr ( ) -> gt ( 'indexed' , 0 ) ) -> execute ( ) -> fetchColumn ( 0 ) ; }
Checks whether the Index Queue contains a specific item that has been marked as indexed .
37,207
public function deleteItem ( string $ itemType , int $ itemUid = null ) { $ itemUids = empty ( $ itemUid ) ? [ ] : [ $ itemUid ] ; $ this -> deleteItems ( [ ] , [ ] , [ $ itemType ] , $ itemUids ) ; }
Removes an item from the Index Queue .
37,208
public function deleteItemsBySite ( Site $ site , string $ indexingConfigurationName = '' ) { $ indexingConfigurationNames = empty ( $ indexingConfigurationName ) ? [ ] : [ $ indexingConfigurationName ] ; $ this -> deleteItems ( [ $ site ] , $ indexingConfigurationNames ) ; }
Removes all items of a certain site from the Index Queue . Accepts an optional parameter to limit the deleted items by indexing configuration .
37,209
public function deleteItems ( array $ sites = [ ] , array $ indexQueueConfigurationNames = [ ] , array $ itemTypes = [ ] , array $ itemUids = [ ] , array $ uids = [ ] ) { $ rootPageIds = Site :: getRootPageIdsFromSites ( $ sites ) ; $ indexQueueConfigurationList = implode ( "," , $ indexQueueConfigurationNames ) ; $ it...
Removes items in the index queue filtered by the passed arguments .
37,210
private function addItemWhereClauses ( QueryBuilder $ queryBuilderForDeletingItems , array $ rootPageIds , string $ indexQueueConfigurationList , string $ itemTypeList , array $ itemUids , array $ uids ) : QueryBuilder { if ( ! empty ( $ rootPageIds ) ) { $ queryBuilderForDeletingItems -> andWhere ( $ queryBuilderForDe...
Initializes the query builder to delete items in the index queue filtered by the passed arguments .
37,211
private function buildQueryForPropertyDeletion ( QueryBuilder $ queryBuilderForDeletingItems , array $ rootPageIds , string $ indexQueueConfigurationList , string $ itemTypeList , array $ itemUids , array $ uids ) : QueryBuilder { $ queryBuilderForDeletingProperties = $ queryBuilderForDeletingItems -> getConnection ( )...
Initializes a query builder to delete the indexing properties of an item by the passed conditions .
37,212
public function findItemByUid ( int $ uid ) { $ queryBuilder = $ this -> getQueryBuilder ( ) ; $ indexQueueItemRecord = $ queryBuilder -> select ( '*' ) -> from ( $ this -> table ) -> where ( $ queryBuilder -> expr ( ) -> eq ( 'uid' , $ uid ) ) -> execute ( ) -> fetch ( ) ; if ( ! isset ( $ indexQueueItemRecord [ 'uid'...
Gets a single Index Queue item by its uid .
37,213
public function findItemsByItemTypeAndItemUid ( string $ itemType , int $ itemUid ) : array { $ queryBuilder = $ this -> getQueryBuilder ( ) ; $ compositeExpression = $ queryBuilder -> expr ( ) -> andX ( $ queryBuilder -> expr ( ) -> eq ( 'item_type' , $ queryBuilder -> getConnection ( ) -> quote ( $ itemType , \ PDO :...
Gets Index Queue items by type and uid .
37,214
protected function getItemsByCompositeExpression ( CompositeExpression $ expression = null , QueryBuilder $ queryBuilder = null ) : array { if ( ! $ queryBuilder instanceof QueryBuilder ) { $ queryBuilder = $ this -> getQueryBuilder ( ) ; } $ queryBuilder -> select ( '*' ) -> from ( $ this -> table ) ; if ( isset ( $ e...
Returns a collection of items by CompositeExpression . D
37,215
public function findAll ( ) : array { $ queryBuilder = $ this -> getQueryBuilder ( ) ; $ allRecords = $ queryBuilder -> select ( '*' ) -> from ( $ this -> table ) -> execute ( ) -> fetchAll ( ) ; return $ this -> getIndexQueueItemObjectsFromRecords ( $ allRecords ) ; }
Returns all items in the queue .
37,216
protected function getIndexQueueItemObjectsFromRecords ( array $ indexQueueItemRecords ) : array { $ tableRecords = $ this -> getAllQueueItemRecordsByUidsGroupedByTable ( $ indexQueueItemRecords ) ; return $ this -> getQueueItemObjectsByRecords ( $ indexQueueItemRecords , $ tableRecords ) ; }
Creates an array of ApacheSolrForTypo3 \ Solr \ IndexQueue \ Item objects from an array of index queue records .
37,217
protected function getAllQueueItemRecordsByUidsGroupedByTable ( array $ indexQueueItemRecords ) : array { $ tableUids = [ ] ; $ tableRecords = [ ] ; foreach ( $ indexQueueItemRecords as $ indexQueueItemRecord ) { $ tableUids [ $ indexQueueItemRecord [ 'item_type' ] ] [ ] = $ indexQueueItemRecord [ 'item_uid' ] ; } fore...
Returns the records for suitable item type .
37,218
protected function hookPostProcessFetchRecordsForIndexQueueItem ( string $ table , array $ uids , array & $ tableRecords ) { if ( ! is_array ( $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'EXTCONF' ] [ 'solr' ] [ 'postProcessFetchRecordsForIndexQueueItem' ] ) ) { return ; } $ params = [ 'table' => $ table , 'uids' => $ uids , 'ta...
Calls defined in postProcessFetchRecordsForIndexQueueItem hook method .
37,219
protected function getQueueItemObjectsByRecords ( array $ indexQueueItemRecords , array $ tableRecords ) : array { $ indexQueueItems = [ ] ; foreach ( $ indexQueueItemRecords as $ indexQueueItemRecord ) { if ( isset ( $ tableRecords [ $ indexQueueItemRecord [ 'item_type' ] ] [ $ indexQueueItemRecord [ 'item_uid' ] ] ) ...
Instantiates a list of Item objects from database records .
37,220
public function markItemAsFailed ( $ item , string $ errorMessage = '' ) : int { $ itemUid = ( $ item instanceof Item ) ? $ item -> getIndexQueueUid ( ) : ( int ) $ item ; $ errorMessage = empty ( $ errorMessage ) ? '1' : $ errorMessage ; $ queryBuilder = $ this -> getQueryBuilder ( ) ; return ( int ) $ queryBuilder ->...
Marks an item as failed and causes the indexer to skip the item in the next run .
37,221
public function updateIndexTimeByItem ( Item $ item ) : int { $ queryBuilder = $ this -> getQueryBuilder ( ) ; return ( int ) $ queryBuilder -> update ( $ this -> table ) -> set ( 'indexed' , time ( ) ) -> where ( $ queryBuilder -> expr ( ) -> eq ( 'uid' , $ item -> getIndexQueueUid ( ) ) ) -> execute ( ) ; }
Sets the timestamp of when an item last has been indexed .
37,222
public function updateChangedTimeByItem ( Item $ item , int $ changedTime ) : int { $ queryBuilder = $ this -> getQueryBuilder ( ) ; return ( int ) $ queryBuilder -> update ( $ this -> table ) -> set ( 'changed' , $ changedTime ) -> where ( $ queryBuilder -> expr ( ) -> eq ( 'uid' , $ item -> getIndexQueueUid ( ) ) ) -...
Sets the change timestamp of an item .
37,223
public function findPageIdsOfExistingMountPagesByMountIdentifier ( string $ identifier ) : array { $ queryBuilder = $ this -> getQueryBuilder ( ) ; $ resultSet = $ queryBuilder -> select ( 'item_uid' ) -> add ( 'select' , $ queryBuilder -> expr ( ) -> count ( '*' , 'queueItemCount' ) , true ) -> from ( $ this -> table ...
Retrieves an array of pageIds from mountPoints that allready have a queue entry .
37,224
public function findAllIndexQueueItemsByRootPidAndMountIdentifierAndMountedPids ( int $ rootPid , string $ identifier , array $ mountedPids ) : array { $ queryBuilder = $ this -> getQueryBuilder ( ) ; return $ queryBuilder -> select ( '*' ) -> from ( $ this -> table ) -> where ( $ queryBuilder -> expr ( ) -> eq ( 'root...
Retrieves an array of items for mount destinations mathed by root page ID Mount Identifier and a list of mounted page IDs .
37,225
public function updateHasIndexingPropertiesFlagByItemUid ( int $ itemUid , bool $ hasIndexingPropertiesFlag ) : int { $ queryBuilder = $ this -> getQueryBuilder ( ) ; return $ queryBuilder -> update ( $ this -> table ) -> where ( $ queryBuilder -> expr ( ) -> eq ( 'uid' , $ queryBuilder -> createNamedParameter ( $ item...
Updates has_indexing_properties field for given Item
37,226
protected function resolveFieldValue ( array $ indexingConfiguration , $ solrFieldName , array $ data ) { $ contentObject = GeneralUtility :: makeInstance ( ContentObjectRenderer :: class ) ; if ( isset ( $ indexingConfiguration [ $ solrFieldName . '.' ] ) ) { $ backupWorkingDirectory = getcwd ( ) ; chdir ( PATH_site )...
Resolves a field to its value depending on its configuration .
37,227
public static function isSerializedValue ( array $ indexingConfiguration , $ solrFieldName ) { $ isSerialized = static :: isSerializedResultFromRegisteredHook ( $ indexingConfiguration , $ solrFieldName ) ; if ( $ isSerialized === true ) { return $ isSerialized ; } $ isSerialized = static :: isSerializedResultFromCusto...
Uses a field s configuration to detect whether its value returned by a content object is expected to be serialized and thus needs to be unserialized .
37,228
protected static function isSerializedResultFromCustomContentElement ( array $ indexingConfiguration , $ solrFieldName ) : bool { $ isSerialized = false ; if ( $ indexingConfiguration [ $ solrFieldName ] == Classification :: CONTENT_OBJECT_NAME ) { $ isSerialized = true ; } if ( $ indexingConfiguration [ $ solrFieldNam...
Checks if the response comes from a custom content element that returns a serialized value .
37,229
protected static function isSerializedResultFromRegisteredHook ( array $ indexingConfiguration , $ solrFieldName ) { if ( ! is_array ( $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'EXTCONF' ] [ 'solr' ] [ 'detectSerializedValue' ] ) ) { return false ; } foreach ( $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'EXTCONF' ] [ 'solr' ] [ 'detectS...
Checks registered hooks if a SerializedValueDetector detects a serialized response .
37,230
protected function applySorting ( array $ facetParameters ) { $ sortingExpression = new SortingExpression ( ) ; $ globalSortingExpression = $ sortingExpression -> getForFacet ( $ this -> sorting ) ; if ( ! empty ( $ globalSortingExpression ) ) { $ facetParameters [ 'facet.sort' ] = $ globalSortingExpression ; } return ...
Reads the facet sorting configuration and applies it to the queryParameters .
37,231
protected function getFacetParameters ( ) { $ facetParameters = [ ] ; $ facetParameters [ 'facet' ] = 'true' ; $ facetParameters [ 'facet.mincount' ] = $ this -> getMinCount ( ) ; $ facetParameters [ 'facet.limit' ] = $ this -> getLimit ( ) ; $ facetParameters [ 'facet.field' ] = $ this -> getFields ( ) ; foreach ( $ t...
Retrieves all parameters that are required for faceting .
37,232
public function getCoreBasePath ( ) { $ pathWithoutLeadingAndTrailingSlashes = trim ( trim ( $ this -> path ) , "/" ) ; $ pathWithoutLastSegment = substr ( $ pathWithoutLeadingAndTrailingSlashes , 0 , strrpos ( $ pathWithoutLeadingAndTrailingSlashes , "/" ) ) ; return '/' . $ pathWithoutLastSegment . '/' ; }
Returns the core name from the configured path without the core name .
37,233
protected function extractContentMarkedForIndexing ( $ html ) { preg_match_all ( '/<!--\s*?TYPO3SEARCH_begin\s*? , $ html , $ indexableContents ) ; $ indexableContent = implode ( $ indexableContents [ 0 ] , '' ) ; $ indexableContent = $ this -> excludeContentByClass ( $ indexableContent ) ; if ( empty ( $ indexableCont...
Extracts the markup wrapped with TYPO3SEARCH_begin and TYPO3SEARCH_end markers .
37,234
public function excludeContentByClass ( $ indexableContent ) { if ( empty ( trim ( $ indexableContent ) ) ) { return $ indexableContent ; } $ excludeClasses = $ this -> getConfiguration ( ) -> getIndexQueuePagesExcludeContentByClassArray ( ) ; if ( count ( $ excludeClasses ) === 0 ) { return $ indexableContent ; } $ is...
Exclude some html parts by class inside content wrapped with TYPO3SEARCH_begin and TYPO3SEARCH_end markers .
37,235
public function getPageTitle ( ) { $ page = $ GLOBALS [ 'TSFE' ] ; if ( $ page -> indexedDocTitle ) { $ pageTitle = $ page -> indexedDocTitle ; } elseif ( $ page -> altPageTitle ) { $ pageTitle = $ page -> altPageTitle ; } else { $ pageTitle = $ page -> page [ 'title' ] ; } return $ pageTitle ; }
Retrieves the page s title by checking the indexedDocTitle altPageTitle and regular page title - in that order .
37,236
public function modifyQuery ( Query $ query ) { $ typoScriptConfiguration = $ this -> searchRequest -> getContextTypoScriptConfiguration ( ) ; $ faceting = FacetingBuilder :: fromTypoScriptConfiguration ( $ typoScriptConfiguration ) ; $ allFacets = $ typoScriptConfiguration -> getSearchFacetingFacets ( ) ; $ facetParam...
Modifies the given query and adds the parameters necessary for faceted search .
37,237
protected function buildFacetingParameters ( $ allFacets , TypoScriptConfiguration $ typoScriptConfiguration ) { $ facetParameters = [ ] ; foreach ( $ allFacets as $ facetName => $ facetConfiguration ) { $ facetName = substr ( $ facetName , 0 , - 1 ) ; $ type = isset ( $ facetConfiguration [ 'type' ] ) ? $ facetConfigu...
Delegates the parameter building to specialized functions depending on the type of facet to add .
37,238
protected function addFacetQueryFilters ( $ resultParameters , $ allFacets , $ keepAllFacetsOnSelection ) { $ facetFilters = [ ] ; if ( ! is_array ( $ resultParameters [ 'filter' ] ) ) { return $ facetFilters ; } $ filtersByFacetName = $ this -> getFiltersByFacetName ( $ resultParameters , $ allFacets ) ; foreach ( $ f...
Adds filters specified through HTTP GET as filter query parameters to the Solr query .
37,239
protected function getFilterTag ( $ facetConfiguration , $ keepAllFacetsOnSelection ) { $ tag = '' ; if ( $ facetConfiguration [ 'keepAllOptionsOnSelection' ] == 1 || $ facetConfiguration [ 'addFieldAsTag' ] == 1 || $ keepAllFacetsOnSelection ) { $ tag = '{!tag=' . addslashes ( $ facetConfiguration [ 'field' ] ) . '}' ...
Builds the tag part of the query depending on the keepAllOptionsOnSelection configuration or the global configuration keepAllFacetsOnSelection .
37,240
protected function getFilterParts ( $ facetConfiguration , $ facetName , $ filterValues ) { $ filterParts = [ ] ; $ type = isset ( $ facetConfiguration [ 'type' ] ) ? $ facetConfiguration [ 'type' ] : 'options' ; $ filterEncoder = $ this -> facetRegistry -> getPackage ( $ type ) -> getUrlDecoder ( ) ; if ( is_null ( $ ...
This method is used to build the filter parts of the query .
37,241
protected function getFiltersByFacetName ( $ resultParameters , $ allFacets ) { $ filters = array_map ( 'urldecode' , $ resultParameters [ 'filter' ] ) ; $ configuredFacets = $ this -> getFacetNamesWithConfiguredField ( $ allFacets ) ; $ filtersByFacetName = [ ] ; foreach ( $ filters as $ filter ) { list ( $ filterFace...
Groups facet values by facet name .
37,242
protected function getFacetNamesWithConfiguredField ( array $ allFacets ) { $ facets = [ ] ; foreach ( $ allFacets as $ facetName => $ facetConfiguration ) { $ facetName = substr ( $ facetName , 0 , - 1 ) ; if ( empty ( $ facetConfiguration [ 'field' ] ) ) { continue ; } $ facets [ ] = $ facetName ; } return $ facets ;...
Gets the facets as configured through TypoScript
37,243
public function decode ( $ range , array $ configuration = [ ] ) { preg_match ( '/(-?\d*?)' . self :: DELIMITER . '(-?\d*)/' , $ range , $ filterParts ) ; if ( $ filterParts [ 1 ] == '' || $ filterParts [ 2 ] == '' ) { throw new \ InvalidArgumentException ( 'Invalid numeric range given' , 1466062730 ) ; } return '[' . ...
Parses the given range from a GET parameter and returns a Solr range filter .
37,244
public function getFilteredCopy ( \ Closure $ filter ) { $ copy = clone $ this ; $ filteredData = [ ] ; foreach ( $ this -> data as $ key => $ item ) { if ( $ filter ( $ item ) ) { $ filteredData [ $ key ] = $ item ; } } $ copy -> data = $ filteredData ; return $ copy ; }
This method can be used to pass a closure to created a filtered copy . The closure get an collection item passed and needs to return true when the item should be kept or false when it can be skipped .
37,245
public static function getResultsFromJson ( $ jsonEncodedResponse ) { $ responseData = json_decode ( $ jsonEncodedResponse , true ) ; if ( is_array ( $ responseData [ 'actionResults' ] ) ) { foreach ( $ responseData [ 'actionResults' ] as $ action => $ serializedActionResult ) { $ responseData [ 'actionResults' ] [ $ a...
Turns a JSON encoded result string back into its PHP representation .
37,246
public function addActionResult ( $ action , $ result ) { if ( is_null ( $ action ) ) { throw new \ RuntimeException ( 'Attempt to provide a result without providing an action' , 1294080509 ) ; } $ this -> results [ $ action ] = $ result ; }
Adds an action s result .
37,247
public function getActionResult ( $ action = null ) { $ result = $ this -> results ; if ( ! empty ( $ action ) ) { $ result = $ this -> results [ $ action ] ; } return $ result ; }
Gets the complete set of results or a specific action s results .
37,248
protected function toJson ( ) { $ serializedActionResults = [ ] ; foreach ( $ this -> results as $ action => $ result ) { $ serializedActionResults [ $ action ] = serialize ( $ result ) ; } $ responseData = [ 'requestId' => $ this -> requestId , 'actionResults' => $ serializedActionResults ] ; return json_encode ( $ re...
Converts the response s data to JSON .
37,249
public function overrideConfigurationWithFlexFormSettings ( $ flexFormData , TypoScriptConfiguration $ solrTypoScriptConfiguration ) { if ( empty ( $ flexFormData ) ) { return ; } $ flexFormConfiguration = $ this -> flexFormService -> convertFlexFormContentToArray ( $ flexFormData ) ; $ flexFormConfiguration = $ this -...
Override the given solrConfiguration with flex form configuration .
37,250
protected function overrideFilter ( array $ flexFormConfiguration ) { $ filter = $ this -> getFilterFromFlexForm ( $ flexFormConfiguration ) ; unset ( $ flexFormConfiguration [ 'search' ] [ 'query' ] [ 'filter' ] ) ; if ( empty ( $ filter ) ) { return $ flexFormConfiguration ; } return array_merge_recursive ( $ flexFor...
Override filter in configuration .
37,251
protected function getFilterFromFlexForm ( array $ flexFormConfiguration ) { $ filterConfiguration = [ ] ; $ filters = ObjectAccess :: getPropertyPath ( $ flexFormConfiguration , 'search.query.filter' ) ; if ( empty ( $ filters ) ) { return $ filterConfiguration ; } foreach ( $ filters as $ filter ) { $ filter = $ filt...
Returns filter in typoscript form from flex form .
37,252
public function getStatus ( ) { $ reports = [ ] ; $ this -> connectionManager = GeneralUtility :: makeInstance ( ConnectionManager :: class ) ; $ solrConnections = $ this -> connectionManager -> getAllConfigurations ( ) ; foreach ( $ solrConnections as $ solrConnection ) { $ reports [ ] = $ this -> getConnectionStatus ...
Compiles a collection of status checks against each configured Solr server .
37,253
protected function getConnectionStatus ( array $ solrConnection ) { $ header = 'Your site has contacted the Apache Solr server.' ; $ this -> responseStatus = Status :: OK ; $ solrAdmin = $ this -> connectionManager -> getSolrConnectionForNodes ( $ solrConnection [ 'read' ] , $ solrConnection [ 'write' ] ) -> getAdminSe...
Checks whether a Solr server is available and provides some information .
37,254
protected function checkSolrVersion ( SolrAdminService $ solr ) { try { $ solrVersion = $ this -> formatSolrVersion ( $ solr -> getSolrServerVersion ( ) ) ; } catch ( \ Exception $ e ) { $ this -> responseStatus = Status :: ERROR ; $ solrVersion = 'Error getting solr version: ' . $ e -> getMessage ( ) ; } return $ solr...
Checks the solr version and adds it to the report .
37,255
protected function checkAccessFilter ( SolrAdminService $ solrAdminService ) { try { $ accessFilterPluginStatus = GeneralUtility :: makeInstance ( AccessFilterPluginInstalledStatus :: class ) ; $ accessFilterPluginVersion = $ accessFilterPluginStatus -> getInstalledPluginVersion ( $ solrAdminService ) ; $ accessFilterM...
Checks the access filter setup and adds it to the report .
37,256
protected function checkPingTime ( SolrAdminService $ solrAdminService ) { try { $ pingQueryTime = $ solrAdminService -> getPingRoundTripRuntime ( ) ; $ pingMessage = ( int ) $ pingQueryTime . ' ms' ; } catch ( PingFailedException $ e ) { $ this -> responseStatus = Status :: ERROR ; $ pingMessage = 'Ping error: ' . $ e...
Checks the ping time and adds it to the report .
37,257
protected function checkSolrConfigName ( SolrAdminService $ solrAdminService ) { try { $ solrConfigMessage = $ solrAdminService -> getSolrconfigName ( ) ; } catch ( \ Exception $ e ) { $ this -> responseStatus = Status :: ERROR ; $ solrConfigMessage = 'Error determining solr config: ' . $ e -> getMessage ( ) ; } return...
Checks the solr config name and adds it to the report .
37,258
protected function checkSolrSchemaName ( SolrAdminService $ solrAdminService ) { try { $ solrSchemaMessage = $ solrAdminService -> getSchema ( ) -> getName ( ) ; } catch ( \ Exception $ e ) { $ this -> responseStatus = Status :: ERROR ; $ solrSchemaMessage = 'Error determining schema name: ' . $ e -> getMessage ( ) ; }...
Checks the solr schema name and adds it to the report .
37,259
public function resolveAction ( $ action ) { if ( ! array_key_exists ( $ action , self :: $ frontendHelperRegistry ) ) { return null ; } $ frontendHelper = GeneralUtility :: makeInstance ( self :: $ frontendHelperRegistry [ $ action ] ) ; if ( ! $ frontendHelper instanceof FrontendHelper ) { $ message = self :: $ front...
Tries to find a frontend helper for a given action . If found creates an instance of the helper .
37,260
protected function buildControllerContext ( ) { $ controllerContext = $ this -> objectManager -> get ( SolrControllerContext :: class ) ; $ controllerContext -> setRequest ( $ this -> request ) ; $ controllerContext -> setResponse ( $ this -> response ) ; if ( $ this -> arguments !== null ) { $ controllerContext -> set...
Initialize the controller context
37,261
public function getSuggestions ( SearchRequest $ searchRequest , array $ additionalFilters = [ ] ) : array { $ requestId = ( int ) $ this -> tsfe -> getRequestedId ( ) ; $ groupList = ( string ) $ this -> tsfe -> gr_list ; $ suggestQuery = $ this -> queryBuilder -> buildSuggestQuery ( $ searchRequest -> getRawUserQuery...
Build an array structure of the suggestions .
37,262
protected function addTopResultsToSuggestions ( SearchRequest $ searchRequest , $ suggestions , array $ additionalFilters ) : array { $ maxDocuments = $ this -> typoScriptConfiguration -> getSuggestNumberOfTopResults ( ) ; $ searchRequest -> setResultsPerPage ( $ maxDocuments ) ; $ searchRequest -> setAdditionalFilters...
Determines the top results and adds them to the suggestions .
37,263
protected function getSolrSuggestions ( SuggestQuery $ suggestQuery ) : array { $ pageId = $ this -> tsfe -> getRequestedId ( ) ; $ languageId = $ this -> tsfe -> sys_language_uid ; $ solr = GeneralUtility :: makeInstance ( ConnectionManager :: class ) -> getConnectionByPageId ( $ pageId , $ languageId ) ; $ search = G...
Retrieves the suggestions from the solr server .
37,264
protected function getSuggestionArray ( SuggestQuery $ suggestQuery , $ solrSuggestions , $ maxSuggestions ) : array { $ queryString = $ suggestQuery -> getQuery ( ) ; $ suggestionCount = 0 ; $ suggestions = [ ] ; foreach ( $ solrSuggestions as $ string => $ count ) { $ suggestion = trim ( $ queryString . ' ' . $ strin...
Extracts the suggestions from solr as array .
37,265
protected function addDocumentsWhenLimitNotReached ( array $ documents , SearchResultCollection $ documentsToAdd , int $ maxDocuments ) : array { $ additionalTopResultsFields = $ this -> typoScriptConfiguration -> getSuggestAdditionalTopResultsFields ( ) ; foreach ( $ documentsToAdd as $ document ) { $ documents [ ] = ...
Adds documents from a collection to the result collection as soon as the limit is not reached .
37,266
protected function getDocumentAsArray ( SearchResult $ document , $ additionalTopResultsFields = [ ] ) : array { $ fields = [ 'link' => $ document -> getUrl ( ) , 'type' => $ document [ 'type_stringS' ] ? $ document [ 'type_stringS' ] : $ document -> getType ( ) , 'title' => $ document -> getTitle ( ) , 'content' => $ ...
Creates an array representation of the result and returns it .
37,267
protected function getResultArray ( SearchRequest $ searchRequest , $ suggestions , $ documents , $ didASecondSearch ) : array { return [ 'suggestions' => $ suggestions , 'suggestion' => $ searchRequest -> getRawUserQuery ( ) , 'documents' => $ documents , 'didSecondSearch' => $ didASecondSearch ] ; }
Creates an result array with the required fields .
37,268
public function loadModuleData ( ) { $ moduleData = $ GLOBALS [ 'BE_USER' ] -> getModuleData ( self :: KEY ) ; $ this -> unsetModuleDataIfCanNotBeSerialized ( $ moduleData ) ; if ( empty ( $ moduleData ) || ! $ moduleData ) { $ moduleData = GeneralUtility :: makeInstance ( ModuleData :: class ) ; } else { $ moduleData ...
Loads module data for user settings or returns a fresh object initially
37,269
private function unsetModuleDataIfCanNotBeSerialized ( string & $ serializedModuleData = null ) { if ( ! isset ( $ serializedModuleData ) ) { $ serializedModuleData = '' ; return ; } if ( false !== strpos ( $ serializedModuleData , 'ApacheSolrForTypo3\\Solr\\Domain\\Model\\ModuleData' ) || false !== strpos ( $ serializ...
Unsets not serializable module data .
37,270
protected function getInitializedCache ( ) { $ cacheIdentifier = 'tx_solr' ; try { $ cacheInstance = GeneralUtility :: makeInstance ( CacheManager :: class ) -> getCache ( $ cacheIdentifier ) ; } catch ( NoSuchCacheException $ e ) { $ typo3CacheFactory = $ GLOBALS [ 'typo3CacheFactory' ] ; $ cacheInstance = $ typo3Cach...
Initializes the cache for this command .
37,271
protected function enrichFrequentSearchesInfo ( array $ frequentSearchTerms , $ minimumSize , $ maximumSize ) { $ frequentSearches = [ ] ; if ( count ( $ frequentSearchTerms ) ) { $ maximumHits = max ( array_values ( $ frequentSearchTerms ) ) ; $ minimumHits = min ( array_values ( $ frequentSearchTerms ) ) ; $ spread =...
Enrich the frequentSearches
37,272
public function getIndexingConfigurationName ( $ recordTable , $ recordUid , TypoScriptConfiguration $ solrConfiguration ) { $ name = $ recordTable ; $ indexingConfigurations = $ solrConfiguration -> getEnabledIndexQueueConfigurationNames ( ) ; foreach ( $ indexingConfigurations as $ indexingConfigurationName ) { if ( ...
Retrieves the name of the Index Queue Configuration for a record .
37,273
public function getRecord ( $ recordTable , $ recordUid , TypoScriptConfiguration $ solrConfiguration ) { $ record = [ ] ; $ indexingConfigurations = $ solrConfiguration -> getEnabledIndexQueueConfigurationNames ( ) ; foreach ( $ indexingConfigurations as $ indexingConfigurationName ) { $ record = $ this -> getRecordIf...
Retrieves a record taking into account the additionalWhereClauses of the Indexing Queue configurations .
37,274
protected function getRecordIfIndexConfigurationIsValid ( $ recordTable , $ recordUid , $ indexingConfigurationName , TypoScriptConfiguration $ solrConfiguration ) { if ( ! $ this -> isValidTableForIndexConfigurationName ( $ recordTable , $ indexingConfigurationName , $ solrConfiguration ) ) { return [ ] ; } $ recordWh...
This method return the record array if the table is valid for this indexingConfiguration . Otherwise an empty array will be returned .
37,275
protected function getRecordForIndexConfigurationIsValid ( $ recordTable , $ recordUid , $ recordWhereClause ) { $ cache = GeneralUtility :: makeInstance ( TwoLevelCache :: class , 'cache_runtime' ) ; $ cacheId = md5 ( 'ConfigurationAwareRecordService' . ':' . 'getRecordIfIndexConfigurationIsValid' . ':' . $ recordTabl...
Returns the row need by getRecordIfIndexConfigurationIsValid either directly from database or from cache
37,276
protected function isValidTableForIndexConfigurationName ( $ recordTable , $ indexingConfigurationName , TypoScriptConfiguration $ solrConfiguration ) { $ tableToIndex = $ solrConfiguration -> getIndexQueueTableNameOrFallbackToConfigurationName ( $ indexingConfigurationName ) ; $ isMatchingTable = ( $ tableToIndex === ...
This method is used to check if a table is an allowed table for an index configuration .
37,277
protected function getPageOverlayRecordIfParentIsAccessible ( $ recordUid , $ parentWhereClause ) { $ overlayRecord = ( array ) BackendUtility :: getRecord ( 'pages' , $ recordUid , '*' ) ; $ overlayParentId = $ overlayRecord [ 'l10n_parent' ] ; $ pageRecord = ( array ) BackendUtility :: getRecord ( 'pages' , $ overlay...
This method retrieves the pages_language_overlay record when the parent record is accessible through the recordWhereClause
37,278
protected function collectPageGarbageByContentChange ( $ ttContentUid ) { $ contentElement = BackendUtility :: getRecord ( 'tt_content' , $ ttContentUid , 'uid, pid' , '' , false ) ; $ this -> deleteInSolrAndUpdateIndexQueue ( 'pages' , $ contentElement [ 'pid' ] ) ; }
Determines the relevant page id for an content element update . Deletes the page from solr and requeues the page for a reindex .
37,279
protected function collectPageGarbageByPageChange ( $ uid ) { $ pageOverlay = BackendUtility :: getRecord ( 'pages' , $ uid , 'l10n_parent' , '' , false ) ; $ uid = empty ( $ pageOverlay [ 'l10n_parent' ] ) || intval ( $ pageOverlay [ 'l10n_parent' ] ) === 0 ? $ uid : $ pageOverlay [ 'l10n_parent' ] ; $ this -> deleteI...
When a page was changed it is removed from the index and index queue .
37,280
protected function collectConnectionInfos ( ) { $ connectedHosts = [ ] ; $ missingHosts = [ ] ; $ invalidPaths = [ ] ; $ path = GeneralUtility :: makeInstance ( Path :: class ) ; $ connections = $ this -> solrConnectionManager -> getConnectionsBySite ( $ this -> selectedSite ) ; if ( empty ( $ connections ) ) { $ this ...
Checks whether the configured Solr server can be reached and provides a flash message according to the result of the check .
37,281
protected function collectIndexFieldsInfo ( ) { $ indexFieldsInfoByCorePaths = [ ] ; $ solrCoreConnections = $ this -> solrConnectionManager -> getConnectionsBySite ( $ this -> selectedSite ) ; foreach ( $ solrCoreConnections as $ solrCoreConnection ) { $ coreAdmin = $ solrCoreConnection -> getAdminService ( ) ; $ inde...
Gets Luke meta data for the currently selected core and provides a list of that data .
37,282
protected function collectIndexInspectorInfo ( ) { $ solrCoreConnections = $ this -> solrConnectionManager -> getConnectionsBySite ( $ this -> selectedSite ) ; $ documentsByCoreAndType = [ ] ; foreach ( $ solrCoreConnections as $ languageId => $ solrCoreConnection ) { $ coreAdmin = $ solrCoreConnection -> getAdminServi...
Retrieves the information for the index inspector .
37,283
protected function getFields ( ResponseAdapter $ lukeData , $ limitNote ) { $ rows = [ ] ; $ fields = ( array ) $ lukeData -> fields ; foreach ( $ fields as $ name => $ field ) { $ rows [ $ name ] = [ 'name' => $ name , 'type' => $ field -> type , 'docs' => isset ( $ field -> docs ) ? $ field -> docs : 0 , 'terms' => i...
Gets field metrics .
37,284
protected function getCoreMetrics ( ResponseAdapter $ lukeData , array $ fields ) { $ coreMetrics = [ 'numberOfDocuments' => $ lukeData -> index -> numDocs , 'numberOfDeletedDocuments' => $ lukeData -> index -> deletedDocs , 'numberOfTerms' => $ lukeData -> index -> numTerms , 'numberOfFields' => count ( $ fields ) ] ;...
Gets general core metrics .
37,285
public function getTypoScriptConfiguration ( array $ configurationArray = null , $ contextPageId = null , $ contextLanguageId = 0 , $ contextTypoScriptPath = '' ) { if ( $ configurationArray == null ) { if ( isset ( $ this -> typoScriptConfigurations [ 'default' ] ) ) { $ configurationArray = $ this -> typoScriptConfig...
Retrieves the TypoScriptConfiguration object from an configuration array pageId languageId and TypoScript path that is used in in the current context .
37,286
protected function getTypoScriptConfigurationInstance ( array $ configurationArray = null , $ contextPageId = null ) { return GeneralUtility :: makeInstance ( TypoScriptConfiguration :: class , $ configurationArray , $ contextPageId ) ; }
This method is used to build the TypoScriptConfiguration .
37,287
public function addMultiple ( $ filterArray ) { foreach ( $ filterArray as $ key => $ value ) { if ( ! $ this -> hasWithName ( $ key ) ) { $ this -> add ( $ value , $ key ) ; } } return $ this ; }
Add s multiple filters to the filter collection .
37,288
protected function getItemsPerPage ( ) { $ perPage = ( int ) $ this -> resultSet -> getUsedSearch ( ) -> getQuery ( ) -> getRows ( ) ; return $ perPage > 0 ? $ perPage : 10 ; }
Determines the number of results per page . When nothing is configured 10 will be returned .
37,289
public function fromApacheSolrDocument ( Document $ originalDocument ) { $ searchResultClassName = $ this -> getResultClassName ( ) ; $ result = GeneralUtility :: makeInstance ( $ searchResultClassName , $ originalDocument -> getFields ( ) ?? [ ] ) ; if ( ! $ result instanceof SearchResult ) { throw new \ InvalidArgume...
This method is used to wrap the original solr document instance in an instance of the configured SearchResult class .
37,290
protected function addWithPending ( Builder $ builder ) { $ builder -> macro ( 'withPending' , function ( Builder $ builder ) { $ this -> remove ( $ builder , $ builder -> getModel ( ) ) ; return $ builder -> whereIN ( $ this -> getStatusColumn ( $ builder ) , [ Status :: APPROVED , Status :: PENDING ] ) ; } ) ; }
Add the with - pending extension to the builder .
37,291
protected function addWithRejected ( Builder $ builder ) { $ builder -> macro ( 'withRejected' , function ( Builder $ builder ) { $ this -> remove ( $ builder , $ builder -> getModel ( ) ) ; return $ builder -> whereIN ( $ this -> getStatusColumn ( $ builder ) , [ Status :: APPROVED , Status :: REJECTED ] ) ; } ) ; }
Add the with - rejected extension to the builder .
37,292
protected function addWithPostponed ( Builder $ builder ) { $ builder -> macro ( 'withPostponed' , function ( Builder $ builder ) { $ this -> remove ( $ builder , $ builder -> getModel ( ) ) ; return $ builder -> whereIN ( $ this -> getStatusColumn ( $ builder ) , [ Status :: APPROVED , Status :: POSTPONED ] ) ; } ) ; ...
Add the with - postpone extension to the builder .
37,293
protected function addWithAnyStatus ( Builder $ builder ) { $ builder -> macro ( 'withAnyStatus' , function ( Builder $ builder ) { $ this -> remove ( $ builder , $ builder -> getModel ( ) ) ; return $ builder ; } ) ; }
Add the with - any - status extension to the builder .
37,294
protected function addApproved ( Builder $ builder ) { $ builder -> macro ( 'approved' , function ( Builder $ builder ) { $ model = $ builder -> getModel ( ) ; $ this -> remove ( $ builder , $ model ) ; $ builder -> where ( $ model -> getQualifiedStatusColumn ( ) , '=' , Status :: APPROVED ) ; return $ builder ; } ) ; ...
Add the Approved extension to the builder .
37,295
protected function addPending ( Builder $ builder ) { $ builder -> macro ( 'pending' , function ( Builder $ builder ) { $ model = $ builder -> getModel ( ) ; $ this -> remove ( $ builder , $ model ) ; $ builder -> where ( $ model -> getQualifiedStatusColumn ( ) , '=' , Status :: PENDING ) ; return $ builder ; } ) ; }
Add the Pending extension to the builder .
37,296
protected function addRejected ( Builder $ builder ) { $ builder -> macro ( 'rejected' , function ( Builder $ builder ) { $ model = $ builder -> getModel ( ) ; $ this -> remove ( $ builder , $ model ) ; $ builder -> where ( $ model -> getQualifiedStatusColumn ( ) , '=' , Status :: REJECTED ) ; return $ builder ; } ) ; ...
Add the Rejected extension to the builder .
37,297
protected function addPostponed ( Builder $ builder ) { $ builder -> macro ( 'postponed' , function ( Builder $ builder ) { $ model = $ builder -> getModel ( ) ; $ this -> remove ( $ builder , $ model ) ; $ builder -> where ( $ model -> getQualifiedStatusColumn ( ) , '=' , Status :: POSTPONED ) ; return $ builder ; } )...
Add the Postponed extension to the builder .
37,298
protected function addApprove ( Builder $ builder ) { $ builder -> macro ( 'approve' , function ( Builder $ builder , $ id = null ) { $ builder -> withAnyStatus ( ) ; return $ this -> updateModerationStatus ( $ builder , $ id , Status :: APPROVED ) ; } ) ; }
Add the Approve extension to the builder .
37,299
protected function addReject ( Builder $ builder ) { $ builder -> macro ( 'reject' , function ( Builder $ builder , $ id = null ) { $ builder -> withAnyStatus ( ) ; return $ this -> updateModerationStatus ( $ builder , $ id , Status :: REJECTED ) ; } ) ; }
Add the Reject extension to the builder .