Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

fix(parser): replace slog.Debug with common.Debug+zap in toc_header_footer (#20071)

jay77721328fadf1f89c
diff --git a/internal/deepdoc/parser/pdf/layout/toc_header_footer.go b/internal/deepdoc/parser/pdf/layout/toc_header_footer.go
index 4f1dce8dae..d56df851fc 100644
--- a/internal/deepdoc/parser/pdf/layout/toc_header_footer.go
+++ b/internal/deepdoc/parser/pdf/layout/toc_header_footer.go
@@ -865,7 +865,8 @@ func RemoveHeaderFooterBoxes(boxes []pdf.TextBox, pageHeights map[int]float64) [
// header/footer on sight — no whitespace gap and no recurrence required,
// and this also fires on documents too short for the recurrence tracks.
if isSitePromo(b.Text) && (b.Bottom <= h*headerMaxZoneRatio || b.Top >= h*footerMinZoneRatio) {
- slog.Debug("header_footer: dropped by site promo", "page", b.PageNumber, "textLen", utf8.RuneCountInString(b.Text))
+ common.Debug("header_footer: dropped by site promo",
+ zap.Int("page", b.PageNumber), zap.Int("textLen", utf8.RuneCountInString(b.Text)))
drop[i] = struct{}{}
if b.Bottom <= h*headerMaxZoneRatio {
promoSpots = append(promoSpots, promoSpot{page: b.PageNumber, band: "header"})
@@ -911,7 +912,8 @@ func RemoveHeaderFooterBoxes(boxes []pdf.TextBox, pageHeights map[int]float64) [
// engine, so the boxes it removes never enter the recurrence statistics
// (which already skip dropped indices) and cannot perturb any "#"-masked count.
for _, idx := range promoCompanionDrops(boxes, perPage, pageHeights, drop, promoSpots) {
- slog.Debug("header_footer: dropped by promo companion", "page", boxes[idx].PageNumber, "zone", bandOf(boxes[idx], pageHeights[boxes[idx].PageNumber]), "textLen", utf8.RuneCountInString(boxes[idx].Text))
+ common.Debug("header_footer: dropped by promo companion",
+ zap.Int("page", boxes[idx].PageNumber), zap.String("zone", bandOf(boxes[idx], pageHeights[boxes[idx].PageNumber])), zap.Int("textLen", utf8.RuneCountInString(boxes[idx].Text)))
drop[idx] = struct{}{}
}
@@ -1018,7 +1020,7 @@ func RemoveHeaderFooterBoxes(boxes []pdf.TextBox, pageHeights map[int]float64) [
// recurrence engine so it only adds drops: the recurrence counts, which
// include these boxes under their masked key, stay untouched.
if seqDrops := findPageNumberSequenceDrops(collectPageNumberCandidates(boxes, pageHeights, pageNumberCeiling(numPages))); len(seqDrops) > 0 {
- slog.Debug("header_footer: dropped by page-number sequence", "boxes", len(seqDrops))
+ common.Debug("header_footer: dropped by page-number sequence", zap.Int("boxes", len(seqDrops)))
for _, idx := range seqDrops {
drop[idx] = struct{}{}
}