fix
This commit is contained in:
parent
d638a36b0f
commit
a8c8682920
@ -31,7 +31,7 @@ import java.util.*;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/v1/file")
|
@RequestMapping("/api/v1/doc")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class FileQueryController {
|
public class FileQueryController {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(FileQueryController.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(FileQueryController.class);
|
||||||
@ -64,26 +64,10 @@ public class FileQueryController {
|
|||||||
return buildSearchResponse(response, requestBody.getFlatKeywords(), page, size);
|
return buildSearchResponse(response, requestBody.getFlatKeywords(), page, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
// 查询指定用户被授权文件
|
||||||
public Map<String, Object> search(@RequestParam String q) throws IOException {
|
@GetMapping("/listUserFiles")
|
||||||
int page = 1;
|
public ResponseEntity<List<UserFileDTO>> listUserFiles(@RequestParam Long userId) {
|
||||||
int size = defaultPageSize;
|
return ResponseEntity.ok(userAppService.listUserFiles(userId));
|
||||||
int from = 0;
|
|
||||||
|
|
||||||
// 单关键词转换成一组组结构
|
|
||||||
List<List<String>> keywordGroups = Collections.singletonList(Collections.singletonList(q));
|
|
||||||
List<String> flatKeywords = Collections.singletonList(q);
|
|
||||||
|
|
||||||
SearchSourceBuilder builder = new SearchSourceBuilder()
|
|
||||||
.query(buildSearchQuery(keywordGroups))
|
|
||||||
.from(from)
|
|
||||||
.size(size)
|
|
||||||
.sort("mtime", SortOrder.DESC);
|
|
||||||
|
|
||||||
SearchRequest request = new SearchRequest("documents").source(builder);
|
|
||||||
SearchResponse response = esClient.search(request, RequestOptions.DEFAULT);
|
|
||||||
|
|
||||||
return buildSearchResponse(response, flatKeywords, page, size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("file-path")
|
@PostMapping("file-path")
|
||||||
@ -173,9 +157,4 @@ public class FileQueryController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 查询指定用户被授权文件
|
|
||||||
@GetMapping("/listUserFiles")
|
|
||||||
public ResponseEntity<List<UserFileDTO>> listUserFiles(@RequestParam Long userId) {
|
|
||||||
return ResponseEntity.ok(userAppService.listUserFiles(userId));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user