Commit c6052948 authored by Thomas Löffler's avatar Thomas Löffler

[TASK] Updates indexer and removes obsolete fields in TS

parent 4588a39b
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
*/ */
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
use ApacheSolrForTypo3\Solr\IndexQueue\Item;
/** /**
* Class Tx_TerFe2_Solr_Indexqueue_TerIndexer * Class Tx_TerFe2_Solr_Indexqueue_TerIndexer
...@@ -46,44 +47,56 @@ class Tx_TerFe2_Solr_Indexqueue_TerIndexer extends \ApacheSolrForTypo3\Solr\Inde ...@@ -46,44 +47,56 @@ class Tx_TerFe2_Solr_Indexqueue_TerIndexer extends \ApacheSolrForTypo3\Solr\Inde
} }
/** /**
* @param \ApacheSolrForTypo3\Solr\IndexQueue\Item $item * Converts an item array (record) to a Solr document by mapping the
* @param int $language * record's fields onto Solr document fields as configured in TypoScript.
* @return array *
* @param Item $item An index queue item
* @param int $language Language Id
* @return Apache_Solr_Document The Solr document converted from the record
*/ */
public function getFullItemRecord(\ApacheSolrForTypo3\Solr\IndexQueue\Item $item, $language = 0) { protected function itemToDocument(Item $item, $language = 0)
$itemRecord = parent::getFullItemRecord($item, $language); {
$document = null;
$itemRecord['minimumTYPO3Version'] = 0;
$itemRecord['maximumTYPO3Version'] = 0; $itemRecord = $this->getFullItemRecord($item, $language);
if (!is_null($itemRecord)) {
// get the uid of the extkey information of the extension $itemIndexingConfiguration = $this->getItemTypeConfiguration($item,
$extensionUid = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow( $language);
'uid',
'tx_terfe2_domain_model_extension', $document = $this->getBaseDocument($item, $itemRecord);
'ext_key = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($itemRecord['ext_key'], 'tx_terfe2_domain_model_extension') $document = $this->addDocumentFieldsFromTyposcript($document, $itemIndexingConfiguration, $itemRecord);
); $document = $this->addSpecialFields($document, $itemRecord);
}
if (isset($extensionUid['uid'])) { return $document;
/** }
* @var $extension Tx_TerFe2_Domain_Model_Extension
*/
$extension = $this->extensionRepository->findByUid($extensionUid['uid']);
if ($extension instanceof Tx_TerFe2_Domain_Model_Extension) { /**
$itemRecord['extensionIcon'] = $this->getExtensionIcon( * @param \Apache_Solr_Document $document
* @param array $itemRecord
* @return \Apache_Solr_Document
*/
public function addSpecialFields(Apache_Solr_Document $document, array $itemRecord)
{
$extension = $this->extensionRepository->findByUid($itemRecord['uid']);
if ($extension instanceof Tx_TerFe2_Domain_Model_Extension) {
$document->setField(
'extensionIcon_stringS',
$this->getExtensionIcon(
$itemRecord['ext_key'], $itemRecord['ext_key'],
$extension->getLastVersion()->getVersionString() $extension->getLastVersion()->getVersionString()
); )
);
$typo3Dependency = $this->getDependencyVersionForPackage($extension, 'typo3'); $typo3Dependency = $this->getDependencyVersionForPackage($extension, 'typo3');
$itemRecord['minimumTYPO3Version'] = $typo3Dependency['minimum']; $document->setField('extensionMinTYPO3Version_tIntS', $typo3Dependency['minimum']);
$itemRecord['maximumTYPO3Version'] = $typo3Dependency['maximum']; $document->setField('extensionMaxTYPO3Version_tIntS', $typo3Dependency['maximum']);
$itemRecord['outdated'] = $extension->getLastVersion()->getReviewState() === -2; $document->setField('outdated_boolS', $extension->getLastVersion()->getReviewState() === -2);
}
} }
return $itemRecord; return $document;
} }
/** /**
......
...@@ -141,14 +141,6 @@ plugin { ...@@ -141,14 +141,6 @@ plugin {
extensionDownloads_intS = downloads extensionDownloads_intS = downloads
# extensionIcon is filled by the ter indexer Tx_TerFe2_Solr_Indexqueue_TerIndexer
extensionIcon_stringS = TEXT
extensionIcon_stringS.field = extensionIcon
# minimumTYPO3Version and maximumTYPO3Version is filled by the ter indexer Tx_TerFe2_Solr_Indexqueue_TerIndexer
extensionMinTYPO3Version_sIntS = minimumTYPO3Version
extensionMaxTYPO3Version_sIntS = maximumTYPO3Version
extensionHasZipFile_intS = SOLR_RELATION extensionHasZipFile_intS = SOLR_RELATION
extensionHasZipFile_intS { extensionHasZipFile_intS {
localField = last_version localField = last_version
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment