Opensolr in Haystack pipelines
opensolr-haystack adds an Opensolr document store, a hybrid retriever and a file converter to Haystack. Your pipelines need no embedder components: documents and queries get their meaning vectors on Opensolr servers.
Install and first pipeline
pip install opensolr-haystack
from haystack import Document, Pipeline
from haystack_integrations.document_stores.opensolr import OpensolrDocumentStore
from haystack_integrations.components.retrievers.opensolr import OpensolrHybridRetriever
# credentials come from OPENSOLR_EMAIL and OPENSOLR_API_KEY
store = OpensolrDocumentStore(index="my_index", create_if_missing=True)
store.write_documents([Document(content="Hybrid search ranks words and meaning together")])
pipe = Pipeline()
pipe.add_component("retriever", OpensolrHybridRetriever(document_store=store))
print(pipe.run({"retriever": {"query": "keyword and meaning search"}}))
What you get
OpensolrDocumentStore: the full document store protocol, with standard filters.OpensolrHybridRetriever: words and meaning ranked together, withalphafor the balance, or meaning only.OpensolrConverter: files and folders turned into documents, a PDF page by page, scans and pictures through OCR.search_by_image(): search with a photo.ai_answer(): a grounded answer written from the best documents, with no generator component and no LLM key.- A keyword-only mode that uses none of your AI allowance.
Links
- Haystack product page
- PyPI and GitHub, with the full guide in the README.
- No account yet? Use the public demo account.