add writeContent option to RegexCaptureParser
@@ -65,6 +65,8 @@ public class RegexCaptureParser extends AbstractParser implements Initializable
return SUPPORTED_TYPES;
}
+ private boolean writeContent = false;
+
@Override
public void parse(InputStream stream, ContentHandler handler, Metadata metadata,
ParseContext context) throws IOException, SAXException, TikaException {
@@ -99,6 +101,10 @@ public class RegexCaptureParser extends AbstractParser implements Initializable
metadata.set(e.getKey(), "true");
}
}
+ if (writeContent) {
+ char[] chars = line.toCharArray();
+ handler.characters(chars, 0, chars.length);
+ }
line = reader.readLine();
}
for (Map.Entry<String, Set<String>> e : keyVals.entrySet()) {
@@ -135,4 +141,9 @@ public class RegexCaptureParser extends AbstractParser implements Initializable
matchMap.put(field, pattern);
}
}
+
+ @Field
+ public void setWriteContent(boolean writeContent) {
+ this.writeContent = writeContent;
+ }
}
