Skip to content

Commit

Permalink
fix: text splitter with tiny documents (fixes #193) (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
sinedied committed Mar 22, 2024
1 parent 6efe240 commit 2e808c7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/indexer/src/lib/document-processor.ts
Expand Up @@ -75,6 +75,10 @@ export class DocumentProcessor {
let start = 0;
let end = length;

if (end <= MAX_SECTION_LENGTH) {
return [{ content: allText, page: findPage(0) }];
}

while (start + SECTION_OVERLAP < length) {
let lastWord = -1;
end = start + MAX_SECTION_LENGTH;
Expand Down

0 comments on commit 2e808c7

Please sign in to comment.