Back to Llama Index

LlamaIndex Readers Integration: Solr

llama-index-integrations/readers/llama-index-readers-solr/README.md

0.14.211.1 KB
Original Source

LlamaIndex Readers Integration: Solr

Overview

Solr Reader retrieves documents through an existing Solr index. These documents can then be used in a downstream LlamaIndex data structure.

Installation

You can install Solr Reader via pip:

bash
pip install llama-index-readers-solr

Usage

python
from llama_index.readers.solr import SolrReader

# Initialize SolrReader with the Solr URL. The Solr URL should include the path
# to the core (if single node) or collection (if Solr Cloud).
reader = SolrReader(endpoint="<Endpoint with full solr path>")

# Load data from Solr index
documents = reader.load_data(
    query={"q": "*:*", "rows": 10},  # Solr query parameters
    field="content_t",  # Only results with populated values in this field will be returned
    metadata_fields=["title_t", "category_s"],
)

This loader is designed to be used as a way to load data into LlamaIndex and/or subsequently used as a Tool in a LangChain Agent.