The postprocess stage re-indexed the chunks it emits and set Size with
len(content), i.e. bytes, while every other place in the package measures a
chunk in runes: splitByLength fills Size with a rune count, mergeChunks
compares against a rune budget and filterChunks applies a rune min_length.
A CJK chunk therefore came back from a pipeline with postprocess enabled three
times longer than the same chunk without it (9 instead of 3 for "知识点"),
and ragflow-cli printed that inflated value as the chunk size.
Summary
PostprocessOperator.Executere-indexes the chunks it emits and recomputesChunkData.Sizewithlen(content), i.e. bytes. Every other measurement ininternal/parser/chunkis in runes:splitByLengthwrites a rune count intoSize,mergeChunkscompares against a runetarget_size,filterChunksapplies a runemin_length, andsplit_test.goassertsSize == utf8.RuneCountInString(content).So enabling any postprocess option (merge or filter) silently changed the reported size of non-ASCII chunks:
知识点came back withSize = 9instead of3, andragflow-cli chunkprinted that inflated number as "Chunk size".Fix
Re-index with
RuneCountso the unit stays consistent with the rest of the package.Test
Added
TestPostprocessSizeCountsRunesininternal/parser/chunk/postprocess_test.go. It fails on the current code (Size = 9, want 3) and passes with the fix.