/** * Resolves a field mapping to its value depending on its configuration. * * Allows to put the page record through cObj processing if wanted / needed. * Otherwise the plain page record field value is used. * * @param string $solrFieldName The Solr field name to resolve the value from the item's record * @return string The resolved string value to be indexed */ protected function resolveFieldValue($solrFieldName) { $fieldValue = ''; $indexingConfiguration = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['index.']['queue.']['pages.']['fields.']; $pageRecord = $GLOBALS['TSFE']->page; if (isset($indexingConfiguration[$solrFieldName . '.'])) { // configuration found => need to resolve a cObj $contentObject = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); $contentObject->start($pageRecord, 'pages'); $fieldValue = $contentObject->cObjGetSingle($indexingConfiguration[$solrFieldName], $indexingConfiguration[$solrFieldName . '.']); if (AbstractIndexer::isSerializedValue($indexingConfiguration, $solrFieldName)) { $fieldValue = unserialize($fieldValue); } } else { $fieldValue = $pageRecord[$indexingConfiguration[$solrFieldName]]; } return $fieldValue; }
/** * @test */ public function testTypeIsNotAllowedOverride() { $this->assertFalse(AbstractIndexer::isAllowedToOverrideField('type'), 'Type is allowed to override'); $this->assertTrue(AbstractIndexer::isAllowedToOverrideField('test_stringS'), 'New dynamic fields was not indicated to be overrideable'); }