Merge document_stores #3451
Answered
by
ZanSara
Rocha-a21906962
asked this question in
Questions
-
Hi there, |
Beta Was this translation helpful? Give feedback.
Answered by
ZanSara
Oct 24, 2022
Replies: 1 comment 1 reply
-
Hey @Rocha-a21906962, FAISSDocumentStore should be able to support both dense and sparse retrievers. from haystack import Document
from haystack.document_stores import FAISSDocumentStore
from haystack.nodes import EmbeddingRetriever, TfidfRetriever
document_store = FAISSDocumentStore(sql_url="sqlite:///")
document_store.write_documents([
Document(content="doc 1"),
Document(content="doc 2"),
Document(content="doc 3")
])
retriever_sparse = TfidfRetriever(document_store=document_store)
retriever_dense = EmbeddingRetriever(document_store=document_store, embedding_model="deepset/sentence_bert")
document_store.update_embeddings(retriever=retriever_dense)
print(retriever_sparse.retrieve(query="doc 2"))
print(retriever_dense.retrieve(query="doc 2")) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Rocha-a21906962
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @Rocha-a21906962, FAISSDocumentStore should be able to support both dense and sparse retrievers.