A software documentation platform builds a RAG system over code repositories. Each repository contains source files, docstrings, inline comments, README files, and API reference documentation. They currently embed all content uniformly. Engineers report that when users ask 'How do I use the authentication middleware?', they retrieve source code chunks rather than the README usage examples, which are more useful for onboarding. What content-type-aware retrieval strategy improves answer quality for usage questions?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Here's the deal — query intent classification combined with content-type metadata filtering directly addresses the retrieval mismatch. 'How do I use X?' signals a usage/onboarding intent where README files and usage examples are the appropriate content type.
Full explanation below image
Full Explanation
Query intent classification combined with content-type metadata filtering directly addresses the retrieval mismatch. 'How do I use X?' signals a usage/onboarding intent where README files and usage examples are the appropriate content type. 'How does the authentication middleware validate JWT tokens?' signals implementation interest where source code is appropriate. Metadata stored with each chunk (content_type: 'readme', 'source', 'docstring', 'api_ref') enables filtering or scoring adjustments based on intent. Option A (remove source code) is too aggressive — implementation queries legitimately benefit from source code, and usage questions sometimes require understanding the function signatures that only source code reveals. Option C (separate embedding models) adds infrastructure complexity (two indices, routing logic) for a problem that metadata filtering solves more simply. Option D (larger documentation chunks) is a blunt heuristic that changes all retrieval, not just usage queries — large chunks degrade retrieval precision for specific questions about implementation details.