add embedding depth to rpw handler
@@ -54,6 +54,10 @@ public abstract class AbstractRecursiveParserWrapperHandler extends DefaultHandl
public final static Property EMBEDDED_RESOURCE_PATH =
Property.internalText(TikaCoreProperties.TIKA_META_PREFIX+"embedded_resource_path");
+ public final static Property EMBEDDED_DEPTH =
+ Property.internalInteger(TikaCoreProperties.TIKA_META_PREFIX+"embedded_depth");
+
+
private final ContentHandlerFactory contentHandlerFactory;
private static final int MAX_DEPTH = 100;
@@ -93,6 +97,7 @@ public abstract class AbstractRecursiveParserWrapperHandler extends DefaultHandl
if (embeddedDepth >= MAX_DEPTH) {
throw new SAXException("Max embedded depth reached: "+embeddedDepth);
}
+ metadata.set(EMBEDDED_DEPTH, embeddedDepth);
}
/**
* This is called after parsing each embedded document. Override this
@@ -120,6 +125,7 @@ public abstract class AbstractRecursiveParserWrapperHandler extends DefaultHandl
if (hasHitMaximumEmbeddedResources()) {
metadata.set(EMBEDDED_RESOURCE_LIMIT_REACHED, "true");
}
+ metadata.set(EMBEDDED_DEPTH, 0);
}
/**
