WeKnora/internal/infrastructure/chunker
adawang 8d3030d339 fix(chunker): carry deep sub-heading context into large-section chunks
When the dominant heading level repeats and becomes the split backbone,
a long section is sub-split via SplitText and every sub-chunk inherited
the section-level breadcrumb. Deep `###`/`####` headings that define a
sub-chunk's meaning were dropped from Chunk.ContextHeader, so queries
about content nested far below a shallow heading failed to retrieve it.

Track the heading hierarchy across the section and assign each sub-chunk
the breadcrumb in effect at its start offset, so the deepest active
heading reaches the breadcrumb. Adds a regression test.

Fixes #1674

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 16:56:57 +08:00
..
header_tracker.go feat(parser): add OpenDataLoader, PaddleOCR-VL engines, and parser improvements 2026-06-03 12:29:13 +08:00
heading_hierarchy.go feat(chunker): heading hierarchy tracker 2026-05-06 17:17:07 +08:00
heading_hierarchy_test.go feat(chunker): heading hierarchy tracker 2026-05-06 17:17:07 +08:00
heading_splitter.go fix(chunker): carry deep sub-heading context into large-section chunks 2026-06-16 16:56:57 +08:00
heading_splitter_test.go fix(chunker): carry deep sub-heading context into large-section chunks 2026-06-16 16:56:57 +08:00
heuristic_splitter.go fix(chunker): trim surrounding whitespace before embedding 2026-05-06 21:16:48 +08:00
heuristic_splitter_test.go fix(chunker): heuristic splitter drops boundaries inside protected spans 2026-05-06 21:16:48 +08:00
patterns.go fix(chunker): recognise CN chapter titles and multi-level numeric headings 2026-05-06 22:14:16 +08:00
patterns_test.go fix(chunker): recognise CN chapter titles and multi-level numeric headings 2026-05-06 22:14:16 +08:00
profiler.go refactor(chunker): drop redundant TierRecursive 2026-05-06 20:23:05 +08:00
profiler_test.go refactor(chunker): drop redundant TierRecursive 2026-05-06 20:23:05 +08:00
splitter.go feat(parser): add OpenDataLoader, PaddleOCR-VL engines, and parser improvements 2026-06-03 12:29:13 +08:00
splitter_test.go feat(parser): add OpenDataLoader, PaddleOCR-VL engines, and parser improvements 2026-06-03 12:29:13 +08:00
strategy.go feat(chunker): SplitParentChild children honour configured strategy 2026-05-06 21:16:48 +08:00
strategy_diagnostics_test.go fix(chunker): post-review fixes for preview endpoint robustness 2026-05-06 17:17:07 +08:00
strategy_test.go fix(chunker): keep top-level heading chunks separate 2026-05-19 17:08:56 +08:00
strategy_token_test.go feat(chunker): recursive priority splitting + token-aware budget 2026-05-06 17:17:07 +08:00
tokens.go fix(chunker): post-review fixes for preview endpoint robustness 2026-05-06 17:17:07 +08:00
tokens_test.go feat(chunker): foundation for adaptive 3-tier chunking 2026-05-06 17:17:07 +08:00
validator.go feat(chunker): foundation for adaptive 3-tier chunking 2026-05-06 17:17:07 +08:00