-
refactor(ingestion/task): extract index-doc mapping into task/indexdoc package (#17749)
发布于
2026-08-04 02:05:27 +00:00 Summary
Extract the pipeline-output → search-engine index document mapping
helpers out of thetaskpackage into a dedicated, dependency-light
leaf packageinternal/ingestion/task/indexdoc.These functions are pure transforms (they only depend on
common/utility) and are not task-orchestration concerns:NormalizeChunks,DeepCopyChunks(was unexporteddeepCopyChunks),
toChunkMaps→indexdoc/normalize.goProcessChunksForPipeline,RenameTextToContentWithWeight,
GetEmbeddingTokenConsumption,cleanupConsumedChunkFields,
mergeChunkMetadata,processChunkPositions,
AggregateTableDocMetadata,resolveTableColumnConfig→
indexdoc/process.goAddPositions→indexdoc/position.goEmbeddingTokenConsumptionKeyconstant →indexdoc/constants.go
(task/constants.go keeps onlyGRAPH_RAPTOR_FAKE_DOC_ID)
Call sites in
pipeline_executor.goandgolden_compare.gonow
reference theindexdocpackage; package-task tests qualify the moved
symbols.Why
The
taskpackage had grown into a "orchestration + pure mapping +
debug" mix. Splitting the pure mapping helpers into a leaf package
sharpens package boundaries, removes a misleading top-level
ingestion/chunkcandidate (there are alreadyparser/chunkand
service/chunk), and lets the golden tool / future reuse pull in the
mapping logic without dragging intask'sdao/engine/service
dependency graph (Go subpackage import does not pull in the parent).Test plan
build.sh --test ./internal/ingestion/task/...— green (task
4.7s, indexdoc 0.007s), matching the pre-change baseline.gofmtclean;build.shbuilds bothragflow-cliand
ragflow_serversuccessfully.- Integration/E2E tiers are delegated to CI (need real MySQL/MinIO/ES
services).
Note:
pipeline_e2e_test.gohas a pre-existing compile error
(server.ElasticsearchConfig/server.InfinityConfigare now defined
underinternal/server/config/, not re-exported byinternal/server).
This is unrelated to this change — the diff to that file is only the
addedindexdocimport and the qualifiedEmbeddingTokenConsumptionKey
reference.下载附件