Problem
Analysts at Chestny Znak, a large company working in a closed perimeter (no cloud services, no external AI assistants), had to search an archive of over half a million documents, refreshed every month. Many were skewed scanned PDFs without a text layer, with complex tables. A request such as "documents from a given agency on a given topic for a given period" took an hour or more by hand. Plain embedding search cannot guarantee that sender, recipient, topic and dates all match at once.
Example from the article: a query for documents from the Prosecutor General's Office about canned fish returned documents from the right agency that were not about canned fish.
Solution in brief
The team built a six-step pipeline: OCR, a YOLO model that finds sender and recipient, a two-collection Qdrant index, cascade search, document-level reranking and a readable result page. Cascade search filters by sender, then recipient, in a short per-document collection, and runs semantic search over chunks only among the survivors. Answers come in seconds.
Questions this case answers
- How to make semantic search over a large corpus of scanned documents respect exact structured conditions on senders, recipients and dates at the same time
- How to rerank retrieved text chunks so that the whole document is judged rather than a single fragment
- How to build production RAG search over hundreds of thousands of scanned PDFs with tables
- How to make semantic search respect structured conditions such as sender, recipient and period
Tools and methods
- DeepSeek OCR — text and table extraction from scans.
- Docling — OCR alternative when there are no tables.
- YOLO — finds sender and recipient regions.
- Qdrant — self-hosted vector database.
- Cascade search — filter by entity first, then search chunks.
- Neighbor-chunk reranking — LLM judges a chunk with its neighbors.
Google or a one-time email code. No password.
