Solr
Solr读取器 #
基类:EventBasePydanticReader
从Solr索引中读取文档。
这些文档随后可用于下游的Llama Index数据结构中。
workflows/handler.py 中的源代码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[文档]
从Solr索引中读取数据。必须至少指定一个字段参数。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
query
|
dict
|
Solr查询参数。
- "q"是必需的。
- "rows"应指定,否则Solr将默认为10。
- 如果提供了"fl",则完全按给定方式使用。
如果未提供"fl",则从
{id_field, field, embedding?, metadata_fields?}构建默认的 |
required |
field
|
str
|
在Solr中作为文档文本检索的字段。 |
required |
id_field
|
str
|
在Solr中作为文档标识符检索的字段。默认为"id"。 |
'id'
|
metadata_fields
|
list[str]
|
要包含为元数据的字段。默认为 None。 |
None
|
embedding
|
str
|
用于嵌入的字段。默认为 None。 |
None
|
引发:
| 类型 | 描述 |
|---|---|
ValueError
|
如果对 Solr 的 HTTP 调用失败。 |
返回:
| 类型 | 描述 |
|---|---|
list[文档]
|
list[Document]: 一个检索到的文档列表,其中字段已填充。 |
workflows/handler.py 中的源代码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 | |
选项: 成员:- SolrReader