|
|
@@ -27,7 +27,6 @@ import org.springframework.util.StringUtils;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.uas.platform.core.model.PageInfo;
|
|
|
import com.uas.platform.core.model.PageParams;
|
|
|
-import com.uas.search.console.LuceneProperties;
|
|
|
import com.uas.search.console.dao.BrandSimpleInfoDao;
|
|
|
import com.uas.search.console.dao.ComponentSimpleInfoDao;
|
|
|
import com.uas.search.console.dao.GoodsSimpleInfoDao;
|
|
|
@@ -104,9 +103,6 @@ public class IndexServiceImpl implements IndexService {
|
|
|
@Autowired
|
|
|
private AQListener aqListener;
|
|
|
|
|
|
- @Autowired
|
|
|
- private LuceneProperties luceneProperties;
|
|
|
-
|
|
|
private IndexSearcherManager indexSearcherManager = IndexSearcherManager.getInstance();
|
|
|
|
|
|
/**
|
|
|
@@ -237,7 +233,8 @@ public class IndexServiceImpl implements IndexService {
|
|
|
Long size = 0L;
|
|
|
try {
|
|
|
// 从本地路径读取器件数据
|
|
|
- File[] files = new File(luceneProperties.getComponentsDir()).listFiles();
|
|
|
+ String componentDataPath = SearchUtils.getDataPath(SearchConstants.COMPONENT_TABLE_NAME);
|
|
|
+ File[] files = new File(componentDataPath).listFiles();
|
|
|
if (files == null || files.length == 0) {
|
|
|
logger.info("创建器件索引失败,原因:器件数据文件不存在!");
|
|
|
return 0L;
|
|
|
@@ -326,7 +323,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
Long size = 0L;
|
|
|
try {
|
|
|
// 从本地路径读取批次数据
|
|
|
- File[] files = new File(luceneProperties.getGoodsDir()).listFiles();
|
|
|
+ File[] files = new File(SearchUtils.getDataPath(SearchConstants.GOODS_TABLE_NAME)).listFiles();
|
|
|
if (files == null || files.length == 0) {
|
|
|
logger.info("创建批次索引失败,原因:批次数据文件不存在!");
|
|
|
return 0L;
|
|
|
@@ -452,11 +449,12 @@ public class IndexServiceImpl implements IndexService {
|
|
|
PrintWriter printWriter = null;
|
|
|
int count = 0;
|
|
|
try {
|
|
|
- File file = new File(luceneProperties.getComponentsDir());
|
|
|
+ String componentDataPath = SearchUtils.getDataPath(SearchConstants.COMPONENT_TABLE_NAME);
|
|
|
+ File file = new File(componentDataPath);
|
|
|
if (!file.exists()) {
|
|
|
file.mkdirs();
|
|
|
}
|
|
|
- printWriter = new PrintWriter(luceneProperties.getComponentsDir() + "/" + fileIndex + ".txt");
|
|
|
+ printWriter = new PrintWriter(componentDataPath + "/" + fileIndex + ".txt");
|
|
|
while (totalElements > size) {
|
|
|
// 一个文件存放100000条数据,一旦超过,写入新的文件
|
|
|
if (count == SINGLE_FILE_MAX_SIZE) {
|
|
|
@@ -464,7 +462,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
printWriter.flush();
|
|
|
printWriter.close();
|
|
|
fileIndex++;
|
|
|
- printWriter = new PrintWriter(luceneProperties.getComponentsDir() + "/" + fileIndex + ".txt");
|
|
|
+ printWriter = new PrintWriter(componentDataPath + "/" + fileIndex + ".txt");
|
|
|
}
|
|
|
List<ComponentSimpleInfo> content = pageResult.getContent();
|
|
|
for (ComponentSimpleInfo element : content) {
|