Package org.apache.tika.metadata.filter
Class LegacyKeyMigrationFilter
java.lang.Object
org.apache.tika.metadata.filter.MetadataFilter
org.apache.tika.metadata.filter.MetadataFilterBase
org.apache.tika.metadata.filter.LegacyKeyMigrationFilter
- All Implemented Interfaces:
Closeable,Serializable,AutoCloseable
Rewrites 4.x metadata keys back to their 3.x spellings (or vice versa) so consumers pinned to 3.x
key names keep working after the 4.0 rename break. Opt-in; enable it in the metadata-filter chain
and it rewrites at the emit edge. Because it runs inside the
MetadataFilter trusted bracket,
it may write reserved (e.g. X-TIKA:/tk:) keys that a plain String write couldn't.
Data-driven, not hand-coded. The renames come from the committed migration table (generated by joining the 3.x and 4.x field-attributed key tables — TIKA-4797):
- flat renames — the enumerated key-for-key changes (the bulk);
- drops — 3.x keys 4.x no longer emits (only relevant on ingest);
- egress-only renames — rows applied only V4_TO_V3, for 3.x spellings that are
ambiguous on ingest (several 4.x keys sharing one bare 3.x key, e.g.
File-Type-Description,version) or unsafe to rewrite there; - prefix rules — open-vocabulary families whose suffix carries through verbatim and so
can't appear as flat table rows (digests, several
KeyPrefixrenames, and egress-only strips for families whose 3.x keys were bare); see each rule method's javadoc.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enumV4_TO_V3 = egress (4.x output rewritten to 3.x keys, the BWC case); V3_TO_V4 = ingest. -
Constructor Summary
ConstructorsConstructorDescriptionLegacyKeyMigrationFilter(JsonConfig jsonConfig) Constructor for JSON configuration; requires Jackson on the classpath. -
Method Summary
Methods inherited from class org.apache.tika.metadata.filter.MetadataFilterBase
doFilterMethods inherited from class org.apache.tika.metadata.filter.MetadataFilter
close, filter, filter
-
Constructor Details
-
LegacyKeyMigrationFilter
public LegacyKeyMigrationFilter() -
LegacyKeyMigrationFilter
-
LegacyKeyMigrationFilter
Constructor for JSON configuration; requires Jackson on the classpath.- Throws:
TikaConfigException
-
-
Method Details
-
filter
- Specified by:
filterin classMetadataFilterBase
-