Skip to main content

Code Examples

Welcome to the companion examples for Scaling Search and Retrieval for Contextual AI, published by O'Reilly Media.

About This Book​

AI models are only as good as the context they can retrieve. Without the right data at the right moment, even the most powerful models fail. Search and retrieval is the most important layer of the AI stack.

This book explores the full lifecycle of search systems—from indexing and query execution to sharding, vector search, hybrid retrieval, and real-world AI integration. What makes it unique is its systems-first, vendor-neutral approach. Rather than explaining how to operate existing tools, it teaches you how to build the tools themselves.

Hands-On with Lucenia​

All examples use Lucenia, a free scalable search and retrieval system for contextual AI. Examples will be added as chapters are finalized.

Book Structure​

The book is organized into four parts:

Part I: Search Fundamentals​

Covers the foundational concepts of search engines, from data structures and indexing pipelines to query execution and the write path.

Part II: Scaling Outward​

Explores horizontal scaling through sharding, distributed query coordination, and snapshot strategies.

Part III: Modern Retrieval and AI Integration​

Dives into hybrid search, vector indexing, RAG pipelines, and multimodal retrieval.

Part IV: Deploying and Operating a Search Platform​

Covers deployment patterns, security, observability, cost optimization, and disaster recovery.


Browse the chapters in the sidebar to see detailed overviews and upcoming examples for each topic.