public class RedisRepository extends java.lang.Object implements RepositoryStorable, RepositoryLifecycle
限定符和类型 | 类和说明 |
---|---|
static class |
RedisRepository.Builder
Builder 类用于链式构建 RedisRepository
|
限定符和类型 | 方法和说明 |
---|---|
static RedisRepository.Builder |
builder(EmbeddingModel embeddingModel,
redis.clients.jedis.UnifiedJedis client)
创建 Redis 知识库
|
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, wait
asyncInsert, asyncSave, delete, exists, insert, insert, insert, save, save
search
public static final java.lang.String BLOB
public static final java.lang.String SCORE
public void initRepository()
initRepository
在接口中 RepositoryLifecycle
public void dropRepository()
dropRepository
在接口中 RepositoryLifecycle
public void save(java.util.List<Document> documents, java.util.function.BiConsumer<java.lang.Integer,java.lang.Integer> progressCallback) throws java.io.IOException
save
在接口中 RepositoryStorable
documents
- 待存储的文档列表progressCallback
- 进度回调java.io.IOException
- 如果存储过程中发生 IO 错误public void deleteById(java.lang.String... ids) throws java.io.IOException
deleteById
在接口中 RepositoryStorable
ids
- 文档 IDjava.io.IOException
public boolean existsById(java.lang.String id) throws java.io.IOException
RepositoryStorable
existsById
在接口中 RepositoryStorable
id
- 文档IDjava.io.IOException
public java.util.List<Document> search(QueryCondition condition) throws java.io.IOException
search
在接口中 Repository
condition
- 搜索条件java.io.IOException
- 如果搜索过程中发生 IO 错误public static RedisRepository.Builder builder(EmbeddingModel embeddingModel, redis.clients.jedis.UnifiedJedis client)
embeddingModel
- 嵌入模型client
- Redis 客户端