提供删除ES数据的接口
This commit is contained in:
parent
1231f0c826
commit
8717ad49b7
@ -2,7 +2,7 @@
|
||||
修订记录
|
||||
|
||||
| 版本 | 时间 | 修订人 | 改动点 |
|
||||
|:-----:|:----------:|:-------:|:-------------------:|
|
||||
|:-----:|:----------:|:-------:|:---------------------------------:|
|
||||
| 1.0.0 | 2025-06-05 | Luke.Ye | 添加修订记录(新增token校验接口) |
|
||||
| 1.0.1 | 2025-06-06 | Luke.Ye | 重构登录Token校验逻辑, |
|
||||
| 1.0.2 | 2025-06-09 | Luke.Ye | 添加用户角色相关逻辑,重构代码 |
|
||||
@ -12,6 +12,7 @@
|
||||
| 1.0.6 | 2025-06-20 | Luke.Ye | 完成对象存储删除接口,优化部分代码 |
|
||||
| 1.0.7 | 2025-06-22 | Luke.Ye | 导入文档类型新增支持ppt & txt |
|
||||
| 1.1.0 | 2025-06-22 | Luke.Ye | 完成llm接口迁移至后端 |
|
||||
| 1.1.1 | 2025-06-26 | Luke.Ye | 提供删除ES数据的接口(ob仓库监听发生删除事件,则同步删除ES) |
|
||||
|
||||
|
||||
|
||||
|
||||
@ -48,4 +48,8 @@ public interface DocAppService {
|
||||
* @param latestMillis --- 最新版本文件的上传时间(毫秒)
|
||||
*/
|
||||
int markOldSearchableRecordsAsDiscarded(String localRelaFilePath, long latestMillis);
|
||||
|
||||
|
||||
|
||||
boolean batchDeleteFilesInES(List<String> filePaths);
|
||||
}
|
||||
|
||||
@ -127,4 +127,10 @@ public class DocAppServiceImpl implements DocAppService{
|
||||
return fileDomainService.updateOldSearchableRecordsByRelaPathAndTime(localRelaFilePath, latestMillis,
|
||||
SearchableStatusEnum.SUCCESS.code, SearchableStatusEnum.DISCARDED.code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean batchDeleteFilesInES(List<String> filePaths) {
|
||||
esGateway.deleteByFilepaths(filePaths);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,41 @@
|
||||
package com.knowledge.base.infrastructure.north.controller;
|
||||
|
||||
import com.knowledge.base.application.service.DocAppService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Obisidian Vault仓库内容发生变化,
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/vault")
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class VaultChangeController {
|
||||
|
||||
private final DocAppService docAppService;
|
||||
|
||||
/**
|
||||
* git仓库发生删除,需同步删除ES
|
||||
* @param relaFilePaths
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/remove-deleted-files-in-es")
|
||||
public ResponseEntity<?> removeDeletedFilesInEs(@RequestBody List<String> relaFilePaths) {
|
||||
log.info("Obsidian Vault中存在文件被删除,开始同步删除ES中的文件,relaFilePaths: {}", relaFilePaths);
|
||||
boolean res = docAppService.batchDeleteFilesInES(relaFilePaths);
|
||||
log.info("完成删除ES数据,res: {}, relaFilePaths: {}", res, relaFilePaths);
|
||||
return ResponseEntity.ok(Map.of(
|
||||
"result", res
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user