修改了es的构建索引的内容的id,修复文档少的went

This commit is contained in:
moon 2025-09-25 16:22:13 +08:00
parent 7a61745cbf
commit 8a357008a3
4 changed files with 9 additions and 6 deletions

View File

@ -110,7 +110,7 @@ export const deleteDataset = (id: string) => {
interface RenameParams {
fileId: number
newName: string
}
}
export const renameDocument = (data: RenameParams) => {
return request({
url: '/brichat-service/datasetManage/document/rename',

View File

@ -133,7 +133,7 @@ public class EsTDatasetFilesServiceImpl implements EsTDatasetFilesService {
try {
client.index(req -> req
.index(subDoc.getDifyDatasetId())
.id(subDoc.getId().toString())
.id(subDoc.getId() + "_" + UUID.randomUUID())
.document(subDoc)
);
log.info("异步添加文档分片到索引 fileId={} docName={}", subDoc.getId(), subDoc.getName());
@ -175,7 +175,7 @@ public class EsTDatasetFilesServiceImpl implements EsTDatasetFilesService {
client.index(req -> req
.index(singleDoc.getDifyDatasetId())
.id(singleDoc.getId().toString())
.id(singleDoc.getId() + "_" + UUID.randomUUID())
.document(singleDoc)
);
log.info("Single文档索引成功 fileId={} docName={}", singleDoc.getId(), singleDoc.getName());

View File

@ -14,6 +14,7 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
@ -76,11 +77,12 @@ public class EsTDatasetFilesImporter {
}
File file = new File(filePath);
if (!file.exists()) {
log.error(file.getAbsolutePath() + " 不存在,跳过");
log.error("文件不存在: {}", file.getAbsolutePath());
failed_2++;
redisTemplate.opsForValue().set("import:task:" + taskId + ":failed2", String.valueOf(failed_2));
continue;
}
if(Boolean.TRUE.equals(document.getIsEs())){
log.warn("documentId=" + document.getId() + " 是ES索引文件跳过");
failed_3++;

View File

@ -261,6 +261,7 @@
SELECT <include refid="Base_Column_List"/>
FROM t_dataset_files
WHERE type = 'file'
and indexing_status='completed'
ORDER BY created_at DESC
</select>