Chunking Documents for Search

Created by Abhyuday DesaiPublished , v1Runs 8 min 6 sec
0 views

About this video

In Episode 02 of Retrieval Explained, we cut one short travel policy into chunks four ways, and ask each version the same question: what is the domestic meal allowance? Cutting every hundred characters splits the answer across two chunks. A larger size keeps it whole but mixes in unrelated rules, and overlap gives text near a cut a second chance without guaranteeing a complete idea. Cutting at the document's own headings keeps each section whole, a recursive splitter adds a size budget for long sections, and each chunk becomes a record with its title, heading and source.

You'll learn how to:

  • Recognize fragmentation, where a cut separates two facts that only make sense together
  • See what chunk size and overlap each cost, and where common starting settings sit in tokens
  • Split at headings with one regular expression, and keep to a size budget with a recursive splitter
  • Build chunk records with an identifier, a source, and an embed text that puts the title and heading in front of the body
  • Choose chunking settings in order, and check them against real questions

This video is for developers building a search over their own documents. The code runs from the companion repo.

What changed

  1. v104 Oct 2026abhydesai8 min 6 secb9e8014

    First published version.

    0 views0 likes on this version