A retrieval system answers a question by finding the passages that probably contain the answer and handing only those to a language model. The model can then be right only if retrieval found the right passage.
You will see how chunk size, overlap and the number of retrieved chunks trade recall against context length, then write the chunker and a TF-IDF ranker yourself.