Skip to content

Commit

Permalink
Merge pull request #86 from jamebal/ocr
Browse files Browse the repository at this point in the history
perf: 重建索引
  • Loading branch information
jamebal authored Jun 5, 2024
2 parents b5b1ae1 + 46fd928 commit 2d147ed
Show file tree
Hide file tree
Showing 10 changed files with 788 additions and 328 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.jmal.clouddisk.annotation.LogOperatingFun;
import com.jmal.clouddisk.annotation.Permission;
import com.jmal.clouddisk.lucene.RebuildIndexTaskService;
import com.jmal.clouddisk.model.LdapConfigDTO;
import com.jmal.clouddisk.model.LogOperation;
import com.jmal.clouddisk.service.IAuthService;
Expand All @@ -15,6 +16,8 @@
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

@RestController
@Tag(name = "网盘设置")
@RequiredArgsConstructor
Expand All @@ -26,12 +29,29 @@ public class CloudSettingController {

private final IAuthService authService;

@Operation(summary = "重建索引")
private final RebuildIndexTaskService rebuildIndexTaskService;

@Operation(summary = "重建索引-用户")
@GetMapping("/user/setting/sync")
@Permission(value = "cloud:file:upload")
@LogOperatingFun
public ResponseResult<Object> userSync(@RequestParam String username, String path) {
return rebuildIndexTaskService.sync(username, path);
}

@Operation(summary = "重建索引-全盘")
@GetMapping("/cloud/setting/sync")
@Permission(value = "cloud:set:sync")
@LogOperatingFun
public ResponseResult<Object> sync() {
return settingService.sync(null);
public ResponseResult<Object> sync(@RequestParam String username) {
return rebuildIndexTaskService.sync(username, null);
}

@Operation(summary = "是否正在同步")
@GetMapping("/user/setting/isSync")
@LogOperatingFun
public ResponseResult<Map<String, Double>> isSync() {
return ResultUtil.success(rebuildIndexTaskService.isSync());
}

@Operation(summary = "上传网盘logo")
Expand All @@ -50,13 +70,6 @@ public ResponseResult<Object> updateNetdiskName(@RequestParam String netdiskName
return settingService.updateNetdiskName(netdiskName);
}

@Operation(summary = "是否正在同步")
@GetMapping("/user/setting/isSync")
@LogOperatingFun
public ResponseResult<Object> isSync(@RequestParam String username) {
return settingService.isSync(username);
}

@Operation(summary = "重置角色菜单")
@PutMapping("/user/setting/resetMenuAndRole")
@Permission(onlyCreator = true)
Expand Down
29 changes: 29 additions & 0 deletions src/main/java/com/jmal/clouddisk/lucene/IndexStatus.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.jmal.clouddisk.lucene;

import lombok.Getter;

/**
* 索引状态
*/
@Getter
public enum IndexStatus {
/**
* 未索引,待索引
*/
NOT_INDEX(0),
/**
* 正在进行索引
*/
INDEXING(1),
/**
* 已完成索引
*/
INDEXED(2);

private final int status;

IndexStatus(int status) {
this.status = status;
}

}
Loading

0 comments on commit 2d147ed

Please sign in to comment.