Gaming Knowledge-Base PDF RAG: Node.js Embeddings, Rerank, and Focused Summaries A developer detailed a Node.js RAG pipeline for gaming knowledge bases that embeds PDF pages, retrieves a broad candidate set via semantic search, reranks candidates against the exact question, and sends only top passages to the final summary model. The approach treats retrieval, reranking, and summarization as separate contracts, preserving page metadata and using injected adapters to keep the pipeline flexible. The developer emphasized that reranking the full document wastes latency and that summarizing raw nearest-neighbor results can overvalue irrelevant passages, recommending a broad retrieve followed by a narrow rerank. A gaming knowledge base can contain hundreds of PDF pages of rules, patch notes, quest logic, and support policy. To summarize those pages without burying the answer, use semantic search to select evidence before the final prompt. Short answer: embed the PDF pages, use semantic search to retrieve a wider candidate set, rerank those candidates for the player's question, and send only the top passages to the final summary model. This is the practical Node.js RAG path when answer quality matters but every extra passage adds latency. The important choice is not "RAG or no RAG." It is where to spend the evidence budget. Retrieval buys coverage. Reranking buys precision. The final model should write from a small, labeled evidence pack rather than rediscover relevance inside a whole PDF. Treat each stage as a separate contract. First, extract text from the PDF and preserve page numbers. Second, split long pages into chunks without throwing away that page metadata. Third, create embeddings once and store them beside the chunks. At question time, semantic search returns plausible passages; rerank reorders them against the exact question; the final summary receives only the winners. That ordering matters. Reranking the full document would waste latency, while summarizing the raw nearest-neighbor results can overvalue passages that share vocabulary but do not answer the question. A broad retrieve followed by a narrow rerank gives each tool one job. For a game-support question such as "Which items remain after a seasonal character reset?", a chunk about seasonal rewards may look close in embedding space even if it never states the reset rule. A reranker gets a second look at the question and each candidate's text. The summary prompt can then require page citations, distinguish explicit rules from adjacent context, and decline to fill gaps. That last instruction matters for private documentation: a fluent guess is still a wrong support answer. Keep page labels all the way through. I would also keep the retrieval and generation settings outside the pipeline. Model IDs change, and a one-person SaaS shouldn't need an application release just to test a different embedding model. The same applies to candidate count and evidence count. They are operating knobs, not business logic. The code below starts after PDF text extraction. That boundary is deliberate: digital PDFs, scanned manuals, and mixed-layout guides need different extraction tools, while the evidence-selection logic stays the same. It uses injected adapters so the orchestration isn't tied to undocumented request fields or a particular SDK. Each adapter returns a typed result, and the pipeline itself is runnable with any implementation that satisfies the contract. type Page = { page: number; text: string; }; type Chunk = { id: string; page: number; text: string; }; type IndexedChunk = Chunk & { embedding: number ; }; type RankedChunk = Chunk & { score: number; }; type RagAdapters = { embed: texts: string = Promise