haystack/releasenotes/notes/in-memory-docstore-memory-share-82b75d018b3545fc.yaml
Silvano Cerza 854c4173f2
feat: Add memory sharing between different instances of InMemoryDocumentStore (#7781)
* Add memory sharing between different instances of InMemoryDocumentStore

* Fix FilterRetriever tests

* Fix InMemoryBM25Retriever tests
2024-05-31 16:44:14 +02:00

20 lines
655 B
YAML

---
features:
- |
Add memory sharing between different instances of InMemoryDocumentStore.
Setting the same `index` argument as another instance will make sure that the memory is shared.
e.g.
```python
index = "my_personal_index"
document_store_1 = InMemoryDocumentStore(index=index)
document_store_2 = InMemoryDocumentStore(index=index)
assert document_store_1.count_documents() == 0
assert document_store_2.count_documents() == 0
document_store_1.write_documents([Document(content="Hello world")])
assert document_store_1.count_documents() == 1
assert document_store_2.count_documents() == 1
```