jnioche commented on code in PR #2227:
URL: https://github.com/apache/stormcrawler/pull/2227#discussion_r4231013293
##########
external/tika/src/main/java/org/apache/stormcrawler/tika/ParserBolt.java:
##########
@@ -792,14 +825,43 @@ private static void reparseIntoHandler(String xml,
ContentHandler handler)
/**
* Returns a ParseContext seeded with the components configured in the
"parse-context" section
- * of the Tika configuration.
+ * of the Tika configuration, and with {@link #PDF_MAX_PAGES_PARAM}.
*/
ParseContext createParseContext() {
ParseContext parseContext = new ParseContext();
parseContext.copyFrom(configuredParseContext);
+ setPdfParserConfig(parseContext);
return parseContext;
}
+ private void setPdfParserConfig(ParseContext parseContext) {
+ if (pdfParserConfig != null) {
+ parseContext.setJsonConfig(PDF_PARSER_CONFIG, pdfParserConfig);
+ }
+ }
+
+ /**
+ * Returns the settings of the PDF parser from the "parse-context" section
of the Tika
+ * configuration, if any, with maxPages set to the given value.
+ */
+ private String pdfParserConfig(int maxPages) {
Review Comment:
this has the same name as the field it populates. Best to call it
'generateJSONPDFConfig' ?
--
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]