# Vector DB - Exhaustive search in RAG

**URL:** <https://discuss.huggingface.co/t/vector-db-exhaustive-search-in-rag/62256>\
**Category:** Intermediate\
**Created:** [November 14, 2023, 7:58pm UTC](https://discuss.huggingface.co/t/vector-db-exhaustive-search-in-rag/62256 "2023-11-14T19:58:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Streampunk99](https://avatars.discourse-cdn.com/v4/letter/s/779978/32.png) [@Streampunk99](https://discuss.huggingface.co/u/Streampunk99)\
**Post date:** [November 14, 2023, 7:58pm UTC](https://discuss.huggingface.co/t/vector-db-exhaustive-search-in-rag/62256/1 "2023-11-14T19:58:05Z")

</div>

I have a question about RAGs. When I’m querying a VDM using an LLM how exhaustive is the search?  
For example, if I’m searching a corpus of legal documents for outcomes in specific case scenarios.  
Is the answer I get back based on an exhaustive search of all indexes which contain relevant matches?  
Does it just pull the best X matches based on similarity?  
And/ Or do all those matches make it back into the decoder LLM to inform the answer? Or is there some kind of cut-off? And if so what?

The broader question here is, how well informed will a RAG answer be? And what use cases is it good for and bad for? E.g. will the answer be informed by all the stored information or just a subset of it?

Thanks!
