Class LegacyKeyMigrationFilter

All Implemented Interfaces:
Closeable, Serializable, AutoCloseable

public class LegacyKeyMigrationFilter extends MetadataFilterBase
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 KeyPrefix renames, and egress-only strips for families whose 3.x keys were bare); see each rule method's javadoc.
Unmapped keys pass through unchanged (this is a compatibility bridge, not an allow-list).
See Also: