8000 bug(parser): DOCParser ignores remove_toc and remove_header_footer configuration · Issue #21987 · infiniflow/ragflow · GitHub
[go: up one dir, main page]

Skip to content

bug(parser): DOCParser ignores remove_toc and remove_header_footer configuration #21987

Open

Description

@ccclucky

Self Checks

  • I have searched for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (Language Policy).
  • Non-English title submissions will be closed directly.
  • Please do not modify this template :) and fill in all the required fields.

RAGFlow workspace code commit ID

5b54cb0dad44c7bed82d5d9786dd87c50ba7ba8c (branch main)

Actual behavior

In the Go ingestion pipeline, defaultSetups() (internal/ingestion/component/parser.go:315-319) declares remove_toc: false and remove_header_footer: false for the doc file family:

		"doc": {
			"remove_toc":           false,
			"remove_header_footer": false,
			"suffix":               []string{"doc"},
		},

Additionally, pipeline templates (e.g. ingestion_pipeline_book.json) and the web client (web/src/pages/agent/utils.ts:300-305) configure and send remove_toc and remove_header_footer for FileType.Doc.

However, DOCParser (internal/parser/parser/doc_parser.go):

  1. Does not implement parserSetupConfigurer (ConfigureFromSetup(map[string]any)), causing configureParserFromSetups (internal/ingestion/component/parser_dispatch.go:48-59) to silently skip passing the doc family setup to the parser.
  2. Lacks RemoveTOC and RemoveHeaderFooter fields on the DOCParser struct.
  3. In ParseWithResult, never checks or applies TOC removal (removeTOCWord with extractDOCXOutlines(irJSON) on structured sections, or removeContentsTable on fallback plain text).

As a result, configuring remove_toc: true on .doc documents is inert, and table-of-contents content is not removed.

Expected behavior

  1. DOCParser should implement ConfigureFromSetup(map[string]any), reading remove_toc and remove_header_footer into DOCParser.RemoveTOC and DOCParser.RemoveHeaderFooter.
  2. When RemoveTOC is enabled, ParseWithResult should remove TOC entries using removeTOCWord(sections, extractDOCXOutlines(irJSON), isEnglishItems(sections)) on structured sections, and removeContentsTable(items, isEnglishItems(items)) on plain-text items.
  3. When RemoveHeaderFooter is enabled, ParseWithResult should filter headers and footers using removeDOCXHeaderFooterSections(sections, extractDOCXHeaderFooterTexts(data)).

Steps to reproduce

  1. In Go, attempt to configure DOCParser from setup:
p := NewDOCParser()
p.ConfigureFromSetup(map[string]any{"remove_toc": true})
  1. Observe that DOCParser does not implement parserSetupConfigurer and lacks ConfigureFromSetup, so configureParserFromSetups silently skips it and ParseWithResult never removes TOC.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0