Solr
SolrReader #
Bases: BasePydanticReader
Read documents from a Solr index.
These documents can then be used in a downstream Llama Index data structure.
Source code in .build/python/llama-index-integrations/readers/llama-index-readers-solr/llama_index/readers/solr/base.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|
load_data #
load_data(
query: dict[str, Any],
field: str,
id_field: str = "id",
metadata_fields: Optional[list[str]] = None,
embedding: Optional[str] = None,
) -> list[Document]
Read data from the Solr index. At least one field argument must be specified.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
dict
|
The Solr query parameters.
- "q" is required.
- "rows" should be specified or will default to 10 by Solr.
- If "fl" is provided, it is respected exactly as given.
If "fl" is NOT provided, a default |
required |
field
|
str
|
Field in Solr to retrieve as document text. |
required |
id_field
|
str
|
Field in Solr to retrieve as the document identifier. Defaults to "id". |
'id'
|
metadata_fields
|
list[str]
|
Fields to include as metadata. Defaults to None. |
None
|
embedding
|
str
|
Field to use for embeddings. Defaults to None. |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
If the HTTP call to Solr fails. |
Returns:
Type | Description |
---|---|
list[Document]
|
list[Document]: A list of retrieved documents where field is populated. |
Source code in .build/python/llama-index-integrations/readers/llama-index-readers-solr/llama_index/readers/solr/base.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|