Document Search
The local-only counterpart to Library: a document search server running on SQLite and Ollama so private drafts and NDA materials never leave the laptop.
Some documents don’t belong in my cloud library: private drafts, client material, and personal notes. I built Document Search to search those files locally, with the extraction, embedding, and retrieval all running on my laptop.
It answers the same question as Library, with a different trade-off. I give up the cloud service’s richer retrieval pipeline in exchange for keeping the documents on my machine and searching offline.
How a file becomes searchable
The ingestion script extracts text from PDF, DOCX, TXT, and EPUB files, splits it into short overlapping passages, and sends them to an embedding model running in Ollama. ChromaDB stores the vectors and text locally.
A query goes through the same embedding model. Chroma finds similar passages and returns the top five with their filenames. The AI client talks to the server through a local process pipe, so the search service needs no listening network port.
A manifest tracks ingested files so rerunning the script skips documents already indexed.
Local or cloud?
For private material or offline work, I use the local version. For my published research collection, I use Library’s hybrid search, reranking, and larger surrounding sections.
Document Search uses short, fixed-size chunks and one retrieval pass. It has less document structure and metadata to work with. It also leaves backups and maintenance to me.
Rough edges
Scanned PDFs need manual OCR before ingestion. PDFs with broken text layers can also fail; checking the extracted text is the first debugging step. Automatic OCR and better handling of malformed text remain planned work.
Building both versions gave me a concrete way to think about the local-versus-cloud decision: which documents can leave the machine, and what search features are worth the extra infrastructure?
Stack
| Part | Tool |
|---|---|
| Runtime and interface | Python, MCP over stdio |
| Local embeddings | Ollama, mxbai-embed-large |
| Search store | ChromaDB, persisted in SQLite |
| Text extraction | pypdf, python-docx, EbookLib |