kwin commented on code in PR #3285:
URL: https://github.com/apache/jackrabbit-oak/pull/3285#discussion_r4538073027
##########
oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/binary/FulltextBinaryTextExtractor.java:
##########
@@ -293,59 +304,52 @@ private static TikaConfigHolder
initializeTikaConfig(@Nullable IndexDefinition d
configSource = "Custom config at " + definition.getIndexPath();
configStream = definition.getTikaConfig();
} else {
- URL configUrl =
FulltextIndexEditorContext.class.getResource("tika-config.xml");
+ URL configUrl =
FulltextIndexEditorContext.class.getResource("tika-config.json");
if (configUrl != null) {
configSource = configUrl.toString();
configStream = configUrl.openStream();
}
}
if (configStream != null) {
- return new TikaConfigHolder(new TikaConfig(configStream),
configSource);
+ return new TikaConfigHolder(TikaJsonConfig.load(configStream),
configSource);
}
- } catch (TikaException | IOException | SAXException e) {
+ } catch (TikaException | IOException e) {
log.warn("Tika configuration not available : {}", configSource, e);
} finally {
IOUtils.closeQuietly(configStream);
Thread.currentThread().setContextClassLoader(current);
}
- return new TikaConfigHolder(TikaConfig.getDefaultConfig(), "Default
Config");
+ return new TikaConfigHolder(TikaJsonConfig.loadDefault(), "Default
Config");
}
- private Parser initializeTikaParser(IndexDefinition definition) {
- ClassLoader current = Thread.currentThread().getContextClassLoader();
- try {
- if (definition.hasCustomTikaConfig()) {
-
Thread.currentThread().setContextClassLoader(FulltextIndexEditorContext.class.getClassLoader());
- return new AutoDetectParser(getTikaConfig());
- }
- } finally {
- Thread.currentThread().setContextClassLoader(current);
+ private Parser initializeTikaParser(IndexDefinition definition) throws
TikaConfigException, IOException {
+ if (definition.hasCustomTikaConfig()) {
+ TikaJsonConfig jsonConfig =
TikaJsonConfig.load(definition.getTikaConfig());
Review Comment:
This used to be XML format so at least some warn with hints how to convert
when detecting an XML config is necessary
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]