Glossary

Document loader

A component that reads a file, web page or other source and returns its text and metadata as documents ready for splitting and indexing.

A document loader is the component in a RAG pipeline that reads a source, such as a PDF, a web page, a database row or a folder of files, and returns its content as standard document objects: text plus metadata like the file name, page number or URL. Everything downstream, from the text splitter to the embedding model and the index, works from what the loader returns, so a loader that drops a table or scrambles reading order limits every answer built on that document.

What a document loader does

The job has three parts. The loader fetches the source, whether from disk, a URL, cloud storage or an API. It parses the format, which might mean PDF parsing, OCR for a scanned page, HTML parsing for a web page or audio transcription for a recording. Then it normalises the result into one shape, so the rest of the pipeline does not need to know where the text came from. In LangChain that shape is a Document with page content and a metadata dictionary.

Loaders sit at the start of data ingestion. They are the extract step of the ETL pattern applied to unstructured data, with splitting and embedding as the transform and the search index as the load target.

Common types of loaders

Loader type

Reads

Typical problems

File loaders

PDF, DOCX, PPTX, EPUB, Markdown, plain text

Tables, columns, headers and footers, scanned pages

Web loaders

Single URLs, sitemaps, crawled pages

JavaScript rendering, menus and banners, paywalls

Media loaders

Audio and video files

Need transcription; video also needs visual analysis

Directory loaders

Folders of mixed files

Choosing a parser per file type, large batches

Connector loaders

SaaS tools and databases through their APIs

Authentication, pagination, permissions, incremental sync

In LangChain, loaders expose load, which returns a list of documents, and lazy_load, which yields them one at a time to keep memory flat on large corpora. LlamaIndex’s SimpleDirectoryReader picks a reader for each file extension in a folder, adds file metadata such as path, name, type, size and dates, and can load files in parallel worker processes.

Where document loaders break

Many retrieval problems that look like search failures start here. A loader that reads a two-column PDF straight across both columns produces sentences that never existed, which is what reading order and layout analysis prevent. Tables flattened into a run of numbers lose the row and column labels that make them answerable, so table extraction needs its own handling. A scanned PDF with no text layer comes back empty unless the loader falls back to OCR. Web loaders that skip JavaScript rendering miss content that loads late, and those that skip boilerplate removal index menus and cookie banners next to the article.

Metadata matters as much as text. Without a page number or timestamp, the application cannot cite where an answer came from, so source attribution becomes guesswork. Without a stable ID and modified date, there is no way to tell which documents changed, and incremental indexing gives way to full reloads.

Document loaders and Exabase

Extract does the loader’s job behind one endpoint. Send it a file or URL and it detects the type and returns structured JSON with metadata, text chunks with page numbers or timestamps, and thumbnails. It covers PDFs and Word documents, including scanned PDFs through built-in OCR, images, audio and video (transcripts, plus scene detection and visual analysis for video) and web pages rendered with JavaScript. Processing is asynchronous, with results by polling or through extraction webhooks, and the submit extraction job reference lists the options. Add ?format=markdown to get the result as Markdown ready for a prompt.

If you do not need the intermediate output, store files as Resources: each upload is extracted and indexed for Deep Search on arrival, with no loader, splitter or embedding step to run. File extraction walks through the approach, tools such as PDF to JSON and website to Markdown handle single conversions, and Parsing is a product you didn’t mean to build explains the reasoning. The document extraction use case shows it in production, and best document extraction API compares the options.

FAQs

What is a document loader?

A document loader reads a source such as a file, web page or API and returns its text and metadata as documents. It is the first step of a RAG or search pipeline.

What is the difference between a document loader and a text splitter?

The loader gets text out of the source, and the text splitter cuts that text into chunks for embedding. Loading comes first, and the splitter can only work with what the loader extracted.

Which document loader should I use for PDFs?

It depends on the PDFs. Simple digital files work with basic text extraction, while scanned pages, tables and multi-column layouts need OCR and layout analysis. Test on your hardest files, not your cleanest.

Why does my document loader return empty text?

The usual cause is a scanned or image-only PDF with no text layer. The loader needs an OCR fallback, or the file needs converting to a searchable PDF first.

What metadata should a document loader keep?

At minimum a stable source ID, the file name or URL, the page number or timestamp, and a modified date. These support citations, filtering and incremental updates.

Does Exabase have document loaders?

Exabase replaces per-format loaders with one endpoint. Extract accepts files and URLs of any supported type and returns structured JSON or Markdown with text chunks and metadata.

Related pages: Text splitter, Chunk overlap, Data ingestion, Document extraction, PDF parsing, Data pipeline, RAG pipeline, Extract, File extraction, Best document extraction API.

Cut your token spend and give your agent precise context.

Get started in minutes.

Cut your token spend and give your agent precise context.

Get started in minutes.