Tool

Query Solr Data for LlamaIndex

Retrieve documents from an existing Solr index into LlamaIndex with field filtering.

Works with solrllamaindexlangchain

74
Spark score
out of 100
Updated 2 days ago
Version 0.14.23
Models

Add to Favorites

Why it matters

Integrate your Solr data into LlamaIndex for advanced AI applications. This asset allows you to query your Solr index and load the results directly into LlamaIndex data structures.

Outcomes

What it gets done

01

Connect to your Solr index using a provided endpoint.

02

Execute custom Solr queries to retrieve specific data.

03

Extract data from specified fields within Solr documents.

04

Load retrieved data into LlamaIndex for further processing.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/li-reader-readers-solr | bash

Overview

LlamaIndex Readers Integration: Solr

A LlamaIndex reader that retrieves documents from an existing Solr index via a query DSL object, extracting a named field as text. Use when you already index content in Solr and want a query-filtered subset loaded into LlamaIndex.

What it does

The Solr Reader retrieves documents through an existing Solr index, so those documents can be used in a downstream LlamaIndex data structure. SolrReader is initialized with an endpoint that includes the full Solr path - the core path for a single node, or the collection path for a Solr Cloud setup.

load_data takes a Solr query object (such as {"q": "*:*", "rows": 10} to match everything and cap the result count), a field naming which field's populated values should be returned as document text, and a metadata_fields list naming which additional fields get attached as document metadata.

When to use - and when NOT to

Use it when you already have data indexed in Solr and want to bring a specific field's content - filtered by a Solr query - into a LlamaIndex pipeline, with other fields carried along as metadata. Do not use it as a way to write to or administer a Solr index; it only reads documents that already exist in the index using standard Solr query syntax.

Capabilities

load_data runs a Solr query DSL object against the configured endpoint and returns documents built from a named text field, with additional named fields attached as metadata.

How to install

pip install llama-index-readers-solr

Requires a reachable Solr endpoint (core or collection path) - no separate authentication parameters are exposed.

Who it's for

Developers who already index content in Solr and want a specific, query-filtered field's content loaded into LlamaIndex for retrieval or question-answering.

Source README

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:

pip install llama-index-readers-solr

Usage

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.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.