Repository navigation
feat(go): drop empty and duplicate chunks in postprocess filter - #16049
Conversation
📝 WalkthroughWalkthrough
Changesdrop_empty and drop_duplicates filter flags
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@yingfeng @JinHai-CN would appreciate review this PR. |
|
This code is being actively migrated and will be fully migrated to go. For now we don't have plan to change inside task_executor_refactor folder. Thank you. |
af1097f to
19d1547
Compare
What problem does this PR solve?
The Go chunk pipeline's
PostprocessOperatorfilterstage (internal/ingestion/chunk/postprocess.go) only filtered by length (min_length/max_length). It could not drop empty/whitespace-only chunks or duplicate chunks — both standard RAG post-processing steps (blank chunks shouldn't be indexed; identical chunks waste embedding compute and add redundant retrieval results).This adds two optional, default-off booleans to the
filterconfig:drop_empty— drop chunks whose content is empty or whitespace-only.drop_duplicates— drop chunks whose exact content already appeared (order-preserving; the first occurrence is kept).They compose with the existing length bounds and are reflected in
String()for plan explainability. Also adds the first unit tests for the postprocess filter (length bounds, drop_empty, drop_duplicates, combined, exact-content matching, and config parsing).Validation:
gofmtclean,go vet ./internal/ingestion/chunk/clean,go buildok,go test ./internal/ingestion/chunk/— all tests pass.Closes #16048
Type of change