Repository navigation
fix: Stop TextChunker once a chunk reaches the end of the text - #7078
Merged
ntkathole merged 1 commit intoNov 11, 2026
Merged
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7078 +/- ##
=======================================
Coverage 51.79% 51.80%
=======================================
Files 458 458
Lines 57715 57717 +2
Branches 8483 8484 +1
=======================================
+ Hits 29896 29898 +2
Misses 25793 25793
Partials 2026 2026
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
patelchaitany
force-pushed
the
fix/text-chunker-trailing-chunk
branch
2 times, most recently
from
November 2, 2026 07:48
febedd3 to
fd8350d
Compare
patelchaitany
force-pushed
the
fix/text-chunker-trailing-chunk
branch
5 times, most recently
from
November 11, 2026 04:26
88bde94 to
5159d94
Compare
patelchaitany
force-pushed
the
fix/text-chunker-trailing-chunk
branch
from
November 11, 2026 05:34
5159d94 to
3c1d375
Compare
ntkathole
approved these changes
Nov 11, 2026
ntkathole
force-pushed
the
fix/text-chunker-trailing-chunk
branch
from
November 11, 2026 14:38
3c1d375 to
db577fd
Compare
The sliding window kept advancing after the last word was covered, so a leftover window with at least min_chunk_size words was emitted as an extra chunk whose words were all in the previous chunk. Break out of the loop right after the chunk that reaches the end of the text. Fixes feast-dev#7063 Signed-off-by: Chaitany Patel <patelchaitany93@gmail.com>
ntkathole
force-pushed
the
fix/text-chunker-trailing-chunk
branch
from
November 11, 2026 14:39
db577fd to
195d547
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
TextChunker._chunk_by_wordskept advancing its sliding window after a chunk had already reached the end of the text. If the leftover window still had at leastmin_chunk_sizewords, it was emitted as another chunk whose words were all in the previous chunk. With the defaultChunkingConfig, a 100-word document produced a redundantw80–w99chunk, andDocEmbedderwould embed and store it as its own row.This PR breaks out of the loop right after the chunk that reaches the end of the text. Texts that do not reach the end produce the same output as before.
Which issue(s) this PR fixes:
Fixes #7063
Checks
git commit -s)Testing Strategy
Misc
Added
test_no_trailing_chunk_contained_in_previous, which fails before this change and passes after it. The existingTestTextChunkertests pass, and ruff check and format are clean.🤖 Generated with Claude Code