Skip to content

Commit

Permalink
[FEATURE] add config option for MetaDataExtractor
Browse files Browse the repository at this point in the history
  • Loading branch information
hvomlehn-sds authored and dkd-kaehm committed May 3, 2024
1 parent 04716c0 commit 82848ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
3 changes: 3 additions & 0 deletions ext_conf_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ excludeMimeTypes =
# cat=general//50; type=string; label=File size limit when a file should be processed (configured in MB)
fileSizeLimit = 500

# cat=general//60; type=boolean; label=Enable meta data extraction: Registers MetaDataExtractor, including LanguageDetector, if available.
registerMetaDataExtractor = 1

# cat=jar//10; type=string; label=Tika App Jar Path: The absolute path to your Apache Tika app jar file (tika-app-x.x.jar)
tikaPath =

Expand Down
16 changes: 10 additions & 6 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['tika']['extractor']['driverRestrictions']
);

/** @var ExtractorRegistry $metaDataExtractorRegistry */
$metaDataExtractorRegistry = GeneralUtility::makeInstance(ExtractorRegistry::class);
$metaDataExtractorRegistry->registerExtractionService(MetaDataExtractor::class);

$extConf = Util::getTikaExtensionConfiguration();
if ($extConf['extractor'] !== 'solr') {
$metaDataExtractorRegistry->registerExtractionService(LanguageDetector::class);
$registerMetaDataExtractorConf = $extConf['registerMetaDataExtractor'] ?? 1;
if ($registerMetaDataExtractorConf == 1) {
/** @var ExtractorRegistry $metaDataExtractorRegistry */
$metaDataExtractorRegistry = GeneralUtility::makeInstance(ExtractorRegistry::class);
$metaDataExtractorRegistry->registerExtractionService(MetaDataExtractor::class);

if ($extConf['extractor'] !== 'solr') {
$metaDataExtractorRegistry->registerExtractionService(LanguageDetector::class);
}
}

unset($extConf);

/** @var TextExtractorRegistry $textExtractorRegistry */
Expand Down

0 comments on commit 82848ab

Please sign in to comment.