Search every document in doc store for the ques vs the top semantic matches #1187
-
Hi Guys, Thanks for your help with this lib! I am just finding my way around it. I want to get the the (top k) responses to the question from every document in the document store instead of the retriever taking the top instances across all documents. My use case is more in the nature of data retrieval from periodic documents. Would appreciate some pointers around this. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Tagging @tholor @brandenchan @oryx1729 |
Beta Was this translation helpful? Give feedback.
-
Hi @hepbc, cool to hear you are using Haystack this way! This Information extraction style of QA is something we see a lot of potential in! So in this style of QA, you obviously want to iterate over each Q in your set of Qs. In terms of Docs, you also want to iterate over each Doc but make sure you're performing the query on just that single document and not your full set of Docs! To do this, you need to perform some metadata filtering (see this for a basic intro) . The idea is that you attach a unique piece of meta data to Document, and at query time, you isolate a single document to perform the query on by setting a filter. In a very rough sketch, you will want something like this
Let me know how this goes for you! All the best, |
Beta Was this translation helpful? Give feedback.
Hi @hepbc, cool to hear you are using Haystack this way! This Information extraction style of QA is something we see a lot of potential in!
So in this style of QA, you obviously want to iterate over each Q in your set of Qs. In terms of Docs, you also want to iterate over each Doc but make sure you're performing the query on just that single document and not your full set of Docs!
To do this, you need to perform some metadata filtering (see this for a basic intro) . The idea is that you attach a unique piece of meta data to Document, and at query time, you isolate a single document to perform the query on by setting a filter.
In a very rough sketch, you will want something like this