Skip to main content

opensolr-haystack

Haystack integration for Opensolr — managed Apache Solr as a DocumentStore, with server-side embeddings and native hybrid (BM25 + kNN) retrieval.

No embedder components needed in your pipeline — texts and queries are embedded on Opensolr's GPU infrastructure (multilingual E5-large-instruct, 1024 dimensions, cosine).

Product page: opensolr.com/langchain · free 15-day trial, no card, at opensolr.com

pip install opensolr-haystack

Quickstart

from haystack import Document, Pipeline
from haystack_integrations.document_stores.opensolr import OpensolrDocumentStore
from haystack_integrations.components.retrievers.opensolr import OpensolrHybridRetriever

# credentials default to OPENSOLR_EMAIL / OPENSOLR_API_KEY env vars
store = OpensolrDocumentStore(index="mysite__dense", create_if_missing=True)

store.write_documents([
    Document(content="Hybrid search fuses BM25 with vector similarity"),
    Document(content="Cats sleep sixteen hours a day"),
])

pipe = Pipeline()
pipe.add_component("retriever", OpensolrHybridRetriever(document_store=store))
result = pipe.run({"retriever": {"query": "how do keyword and semantic search combine?"}})
print(result["retriever"]["documents"])

Note there is no embedder in the pipeline — not for documents, not for the query. The store embeds server-side at both index and query time.

Hybrid retrieval

OpensolrHybridRetriever fuses BM25 and kNN scores per document via Opensolr's native {!hybrid} Solr query parser:

OpensolrHybridRetriever(
    document_store=store,
    top_k=10,
    hybrid=True,     # False = pure semantic kNN
    alpha=0.5,       # 0 = all semantic … 1 = all lexical
)

Standard Haystack filters are supported and map to Solr fq:

pipe.run({"retriever": {
    "query": "search engines",
    "filters": {"field": "meta.category", "operator": "==", "value": "docs"},
}})

Notes

  • Vector-enabled indexes run on Opensolr's Solr 9.x environments — currently us (Chicago), de (Germany), fi (Finland). Additional dedicated regions can be deployed on request (paid add-on): support@opensolr.com.
  • Every index is also plain Apache Solr with the native /select API — facets, highlighting, spellcheck included.
  • Siblings: langchain-opensolr · llama-index-opensolr · opensolr-mcp

MIT license.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opensolr_haystack-0.1.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opensolr_haystack-0.1.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file opensolr_haystack-0.1.0.tar.gz.

File metadata

  • Download URL: opensolr_haystack-0.1.0.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.12

File hashes

Hashes for opensolr_haystack-0.1.0.tar.gz
Algorithm Hash digest
SHA256 918aa5cb1c93db239a177c406dc14cd8d05f9c20d811e77b1dd5f7076a60d46d
MD5 254aabc9cb75d6a3e0ac9702b953ca81
BLAKE2b-256 181122441cf3e9f00fb691860a24f7c573814a9cf3da78247bfc05de3d6cbd9b

See more details on using hashes here.

File details

Details for the file opensolr_haystack-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for opensolr_haystack-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c5308713eb7a90d00b0768c325de91b2820a79e5fbeb740ba74e5e1900e2e15d
MD5 227ffead9ad33a31f565594c4d0c52ae
BLAKE2b-256 003e92778eea5efcd92b647b0a270f3afa9d9daa374251d87354a8ec446340e8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page