|
@@ -9,6 +9,7 @@ import com.doc.common.config.EsConfig;
|
|
|
import com.doc.common.constant.Constants;
|
|
import com.doc.common.constant.Constants;
|
|
|
import com.doc.common.utils.FileContentUtils;
|
|
import com.doc.common.utils.FileContentUtils;
|
|
|
import com.doc.common.utils.StringUtils;
|
|
import com.doc.common.utils.StringUtils;
|
|
|
|
|
+import com.doc.common.utils.Tools;
|
|
|
import com.doc.common.utils.file.FileUtils;
|
|
import com.doc.common.utils.file.FileUtils;
|
|
|
import com.doc.common.utils.file.PdfUtils;
|
|
import com.doc.common.utils.file.PdfUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -69,7 +70,7 @@ public class ElasticSearchServiceImpl implements IElasticSearchService {
|
|
|
Map<String, Function<byte[], String>> handlerMap = createHandlerMap(fileType);
|
|
Map<String, Function<byte[], String>> handlerMap = createHandlerMap(fileType);
|
|
|
String content = getContent(handlerMap, fileType, info.getFileId());
|
|
String content = getContent(handlerMap, fileType, info.getFileId());
|
|
|
boolean pdfOcr = Boolean.parseBoolean(environment.getProperty("ruoyi.pdfOcr"));
|
|
boolean pdfOcr = Boolean.parseBoolean(environment.getProperty("ruoyi.pdfOcr"));
|
|
|
- if (pdfOcr && Constants.PDF_EXTENSION.contains(fileType) && StringUtils.isEmpty(content)) {
|
|
|
|
|
|
|
+ if (pdfOcr && Constants.PDF_EXTENSION.contains(fileType) && Tools.contentEmpty(content)) {
|
|
|
//如果是PDF未解析成功,则另外进行解析工作
|
|
//如果是PDF未解析成功,则另外进行解析工作
|
|
|
indexService.insertDocIndex(new DocIndex(info));
|
|
indexService.insertDocIndex(new DocIndex(info));
|
|
|
return;
|
|
return;
|
|
@@ -102,7 +103,7 @@ public class ElasticSearchServiceImpl implements IElasticSearchService {
|
|
|
} else {
|
|
} else {
|
|
|
Map<String, Function<byte[], String>> handlerMap = createHandlerMap(fileType);
|
|
Map<String, Function<byte[], String>> handlerMap = createHandlerMap(fileType);
|
|
|
content = getContent(handlerMap, fileType, info.getFileId());
|
|
content = getContent(handlerMap, fileType, info.getFileId());
|
|
|
- if (Constants.PDF_EXTENSION.contains(fileType) && StringUtils.isEmpty(content)) {
|
|
|
|
|
|
|
+ if (Constants.PDF_EXTENSION.contains(fileType) && Tools.contentEmpty(content)) {
|
|
|
//如果是PDF未解析成功,则另外进行解析工作
|
|
//如果是PDF未解析成功,则另外进行解析工作
|
|
|
content = getContent(fileType, info.getFileId());
|
|
content = getContent(fileType, info.getFileId());
|
|
|
}
|
|
}
|