Skip to content

Commit

Permalink
perf: 优化更新文件内容索引
Browse files Browse the repository at this point in the history
  • Loading branch information
jamebal committed May 17, 2024
1 parent 005ffd1 commit c2fa83a
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,6 @@ public void modifyFile(String username, File file) {

String suffix = FileUtil.extName(fileName);
String contentType = FileContentTypeUtils.getContentType(suffix);

// 文件是否存在
FileDocument fileDocument = mongoTemplate.findOne(query, FileDocument.class, COLLECTION_NAME);
if (fileDocument != null) {
Expand All @@ -800,8 +799,8 @@ public void modifyFile(String username, File file) {
update.set("contentText", markDownContent);
}
pushMessage(username, fileDocument, "updateFile");
if (null != updateResult.getUpsertedId()) {
updateResult.getUpsertedId().asObjectId().getValue().toHexString();
if (updateResult.getModifiedCount() > 0) {
luceneService.pushCreateIndexQueue(fileDocument.getId());
}
}
}
Expand Down

0 comments on commit c2fa83a

Please sign in to comment.