@Preview(value="3.4") public class OpenSearchRepository extends java.lang.Object implements RepositoryStorable, RepositoryLifecycle
| 限定符和类型 | 类和说明 |
|---|---|
static class |
OpenSearchRepository.Builder
OpenSearch 知识库构建器
|
static class |
OpenSearchRepository.IndexMethod
OpenSearch 索引方法
|
| 限定符和类型 | 方法和说明 |
|---|---|
static OpenSearchRepository.Builder |
builder(EmbeddingModel embeddingModel,
org.opensearch.client.RestHighLevelClient client)
创建 OpenSearch 知识库构建器
|
void |
deleteById(java.lang.String... ids)
删除指定ID的文档
|
void |
dropRepository()
注销仓库
|
boolean |
existsById(java.lang.String id)
检查文档是否存在
|
void |
initRepository()
初始化仓库
|
void |
save(java.util.List<Document> documents,
java.util.function.BiConsumer<java.lang.Integer,java.lang.Integer> progressCallback)
批量存储文档(支持更新)
|
java.util.List<Document> |
search(QueryCondition condition)
搜索文档
支持向量相似度搜索和元数据过滤
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasyncInsert, asyncSave, delete, exists, insert, insert, insert, save, savesearchpublic void initRepository()
initRepository 在接口中 RepositoryLifecyclepublic void dropRepository()
throws java.io.IOException
dropRepository 在接口中 RepositoryLifecyclejava.io.IOExceptionpublic java.util.List<Document> search(QueryCondition condition) throws java.io.IOException
search 在接口中 Repositorycondition - 查询条件,包含查询文本、过滤器等java.io.IOException - 如果搜索过程中发生IO错误public void save(java.util.List<Document> documents, java.util.function.BiConsumer<java.lang.Integer,java.lang.Integer> progressCallback) throws java.io.IOException
save 在接口中 RepositoryStorabledocuments - 要存储的文档列表progressCallback - 进度回调java.io.IOException - 如果存储过程中发生IO错误public void deleteById(java.lang.String... ids)
throws java.io.IOException
deleteById 在接口中 RepositoryStorableids - 文档IDsjava.io.IOExceptionpublic boolean existsById(java.lang.String id)
existsById 在接口中 RepositoryStorableid - 文档IDpublic static OpenSearchRepository.Builder builder(EmbeddingModel embeddingModel, org.opensearch.client.RestHighLevelClient client)
embeddingModel - 嵌入模型client - OpenSearch 客户端