Merge branch 'develop_master' into FOTON

This commit is contained in:
super_liu
2022-05-01 14:19:13 +08:00
2 changed files with 13 additions and 6 deletions
@@ -1221,7 +1221,7 @@ public class SearchCenterServiceImpl implements SearchCenterService {
hiBuilder.field(highlightDate);
hiBuilder.preTags("<span class='highlight-class'>");
hiBuilder.postTags("</span>");
updateIndex("fulltextserch",99999999,2);
updateIndex("fulltextserch",(searchInfoEO.getPage()-1)*searchInfoEO.getPageSize(),searchInfoEO.getPageSize());
searchRequestBuilder = client.prepareSearch("fulltextserch")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.highlighter(hiBuilder)
@@ -1515,7 +1515,7 @@ public class SearchCenterServiceImpl implements SearchCenterService {
hiBuilder.preTags("<span class='highlight-class'>");
hiBuilder.postTags("</span>");
updateIndex("fulltextserch",99999999,2);
updateIndex("fulltextserch",(searchInfoEO.getPage()-1)*searchInfoEO.getPageSize(),searchInfoEO.getPageSize());
searchRequestBuilder = client.prepareSearch("fulltextserch")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.highlighter(hiBuilder)
@@ -1586,6 +1586,7 @@ public class SearchCenterServiceImpl implements SearchCenterService {
AcknowledgedResponse indexResponse = client.admin().indices()
.prepareUpdateSettings(indices)
.setSettings(Settings.builder()
.put("index.max_result_window", records)
.put("highlight.max_analyzed_offset", records)
.build()
).get();
@@ -111,6 +111,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.sql.Clob;
@@ -2973,22 +2974,26 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
// 判断文件是docx还是PDF
if (null != attFileEO.getFileSuffix() && (attFileEO.getFileSuffix().equals("docx") || attFileEO.getFileSuffix().equals("doc") || attFileEO.getFileSuffix().equals("DOC") || attFileEO.getFileSuffix().equals("DOCX") || attFileEO.getFileSuffix().equals("ppt") || attFileEO.getFileSuffix().equals("pptx"))) {
if (attFileEO.getFileSuffix().equals("doc") || attFileEO.getFileSuffix().equals("docx") || attFileEO.getFileSuffix().equals("DOC") || attFileEO.getFileSuffix().equals("DOCX")) {
FileInputStream fis = new FileInputStream(readFilePath);
if (FileMagic.valueOf(fis) == FileMagic.OOXML) {
XWPFDocument doc = new XWPFDocument(fis);
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(new File(readFilePath)));
if (FileMagic.valueOf(bis) == FileMagic.OOXML) {
XWPFDocument doc = new XWPFDocument(bis);
XWPFWordExtractor extractor = new XWPFWordExtractor(doc);
String txt = extractor.getText();
content.append(txt);
extractor.close();
}else {
WordExtractor wordExtractor = new WordExtractor(fis);
WordExtractor wordExtractor = new WordExtractor(bis);
String txt = wordExtractor.getText();
content.append(txt);
wordExtractor.close();
}
bis.close();
} else {
OPCPackage opcPackage = XWPFDocument.openPackage(readFilePath);
XWPFWordExtractor extractor = new XWPFWordExtractor(opcPackage);
String txt = extractor.getText();
content.append(txt);
opcPackage.close();
}
} else {
PDDocument document = PDDocument.load(new File(readFilePath));
@@ -3001,6 +3006,7 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
// String[] lines = pdfFileInText.split("\\r?\\n");
content.append(pdfFileInText);
}
document.close();
}
} catch (Exception e) {
logger.error("搜索中心新增数据读取文档内容时失败");