# Filter records from RetrievalQA chain

**URL:** https://forum.weaviate.io/t/filter-records-from-retrievalqa-chain/1501
**Category:** Support
**Created:** [February 16, 2024, 5:41am UTC](https://forum.weaviate.io/t/filter-records-from-retrievalqa-chain/1501 "2024-02-16T05:41:29Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Abhishek\_Joshi](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/abhishek_joshi/32/559_2.png) [@Abhishek\_Joshi](https://forum.weaviate.io/u/Abhishek_Joshi)
#### Post date: [February 16, 2024, 5:41am UTC](https://forum.weaviate.io/t/filter-records-from-retrievalqa-chain/1501/1 "2024-02-16T05:41:29Z")

</div>

How to filter records based on identifier (識別子) word in JAPANESE,

i have stored documents to vector db as  
識別子「xyz」のために、モジュールは「abc」であれば、ページは「747」

and i am using code as

vectorstore = Weaviate(client, “dbname”, “final\_document”)

qa\_chain = RetrievalQA.from\_chain\_type(llm=llm,  
chain\_type=‘stuff’,  
retriever=vectorstore.as\_retriever(search\_kwargs={‘k’: 4}),  
return\_source\_documents=True,  
chain\_type\_kwargs={‘prompt’: prompt}  
)

final\_document is key against which docs are stored to vector db

---

<div class="post-metadata">

### Author: ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)
#### Post date: [February 16, 2024, 1:05pm UTC](https://forum.weaviate.io/t/filter-records-from-retrievalqa-chain/1501/2 "2024-02-16T13:05:08Z")

</div>

Hi @Abhishek_Joshi !

Is this Langchain?

If that’s the case (llamaindex and langchain sometimes have similar syntax/api) we have here a recipe that can ilustrate that:

> <https://github.com/weaviate/recipes/blob/main/integrations/langchain/loading-data/langchain-simple-pdf.ipynb>

```auto
#source_file = "brazil-wikipedia-article-text.pdf"
source_file = "netherlands-wikipedia-article-text.pdf"
where_filter = {
      "operator": "Equal",
      "path": ["source"],
      "valueText": source_file
  }

# we want our retriever to filter the results
retriever = db.as_retriever(search_kwargs={"where_filter": where_filter})

```

Let me know if that helps.

---

<div class="post-metadata">

### Author: ![Abhishek\_Joshi](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/abhishek_joshi/32/559_2.png) [@Abhishek\_Joshi](https://forum.weaviate.io/u/Abhishek_Joshi)
#### Post date: [May 30, 2024, 11:30am UTC](https://forum.weaviate.io/t/filter-records-from-retrievalqa-chain/1501/3 "2024-05-30T11:30:22Z")

</div>

can I pass multiple where conditions on different properties  
like  
country equal USA  
currency equal USD

in single where\_filter dictionary?

---

<div class="post-metadata">

### Author: ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)
#### Post date: [May 31, 2024, 6:57pm UTC](https://forum.weaviate.io/t/filter-records-from-retrievalqa-chain/1501/4 "2024-05-31T18:57:26Z")

</div>

Sure thing!

Here is the docs for that:

> **[Filters | Weaviate - Vector Database](https://weaviate.io/developers/weaviate/search/filters#filter-with-multiple-conditions)**
>
> Filters let you include, or exclude, particular objects from your result set based on provided conditions.

Let me know if this helps 🙂

---

<div class="post-metadata">

### Author: ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)
#### Post date: [May 31, 2024, 6:58pm UTC](https://forum.weaviate.io/t/filter-records-from-retrievalqa-chain/1501/5 "2024-05-31T18:58:48Z")

</div>

By the way, since this thread, a new integration for Langchain + Weaviate was released:

> **[GitHub - langchain-ai/langchain-weaviate](https://github.com/langchain-ai/langchain-weaviate/)**
>
> Contribute to langchain-ai/langchain-weaviate development by creating an account on GitHub.

This new integration uses Weaviate python v4 client, and delivers way more performance than the previous v3 version.

🙂
