@@ -16,7 +16,8 @@ class FilterRetriever:
16
16
"""
17
17
Retrieves documents that match the provided filters.
18
18
19
- Usage example:
19
+ ### Usage example
20
+
20
21
```python
21
22
from haystack import Document
22
23
from haystack.components.retrievers import FilterRetriever
@@ -31,7 +32,7 @@ class FilterRetriever:
31
32
doc_store.write_documents(docs)
32
33
retriever = FilterRetriever(doc_store, filters={"field": "lang", "operator": "==", "value": "en"})
33
34
34
- # if passed in the run method, filters will override those provided at initialization
35
+ # if passed in the run method, filters override those provided at initialization
35
36
result = retriever.run(filters={"field": "lang", "operator": "==", "value": "de"})
36
37
37
38
print(result["documents"])
@@ -43,7 +44,7 @@ def __init__(self, document_store: DocumentStore, filters: Optional[Dict[str, An
43
44
Create the FilterRetriever component.
44
45
45
46
:param document_store:
46
- An instance of a DocumentStore .
47
+ An instance of a Document Store to use with the Retriever .
47
48
:param filters:
48
49
A dictionary with filters to narrow down the search space.
49
50
"""
@@ -98,8 +99,8 @@ def run(self, filters: Optional[Dict[str, Any]] = None):
98
99
99
100
:param filters:
100
101
A dictionary with filters to narrow down the search space.
101
- If not specified, the FilterRetriever uses the value provided at initialization.
102
+ If not specified, the FilterRetriever uses the values provided at initialization.
102
103
:returns:
103
- The retrieved documents.
104
+ A list of retrieved documents.
104
105
"""
105
106
return {"documents" : self .document_store .filter_documents (filters = filters or self .filters )}
0 commit comments