|
|
@ -149,48 +149,48 @@ public class EsTestController { |
|
|
.build(); |
|
|
.build(); |
|
|
elasticSearchUtil.createIndex("nodes",mappings); |
|
|
elasticSearchUtil.createIndex("nodes",mappings); |
|
|
elasticSearchUtil.createIndex("links",mappings); |
|
|
elasticSearchUtil.createIndex("links",mappings); |
|
|
|
|
|
//
|
|
|
List<ESDao> bookList = new ArrayList<>(); |
|
|
// List<ESDao> bookList = new ArrayList<>();
|
|
|
|
|
|
//
|
|
|
List<ZhyDocApi> docList = zhyDocApiMapper.selectAllDoc1(); |
|
|
// List<ZhyDocApi> docList = zhyDocApiMapper.selectAllDoc1();
|
|
|
for (int i=0;i<docList.size();i++){ |
|
|
// for (int i=0;i<docList.size();i++){
|
|
|
String abstracts = docList.get(i).getDocTitle(); |
|
|
// String abstracts = docList.get(i).getDocTitle();
|
|
|
String id = String.valueOf(docList.get(i).getId()); |
|
|
// String id = String.valueOf(docList.get(i).getId());
|
|
|
|
|
|
//
|
|
|
ESDao esDao = new ESDao(); |
|
|
// ESDao esDao = new ESDao();
|
|
|
esDao.id = id; |
|
|
// esDao.id = id;
|
|
|
esDao.DBid = id; |
|
|
// esDao.DBid = id;
|
|
|
esDao.type = "node"; |
|
|
// esDao.type = "node";
|
|
|
esDao.abstracts = abstracts; |
|
|
// esDao.abstracts = abstracts;
|
|
|
esDao.data = null; |
|
|
// esDao.data = null;
|
|
|
bookList.add(esDao); |
|
|
// bookList.add(esDao);
|
|
|
} |
|
|
// }
|
|
|
elasticSearchUtil.addDocBatch("nodes", bookList, ESDao.class, "id"); |
|
|
// elasticSearchUtil.addDocBatch("nodes", bookList, ESDao.class, "id");
|
|
|
|
|
|
//
|
|
|
List<ESDao> bookList2 = new ArrayList<>(); |
|
|
// List<ESDao> bookList2 = new ArrayList<>();
|
|
|
ZhyArticle zhyArticle = new ZhyArticle(); |
|
|
// ZhyArticle zhyArticle = new ZhyArticle();
|
|
|
List<ZhyArticle> lineList = zhyArticleMapper.selectZhyArticleList(zhyArticle); |
|
|
// List<ZhyArticle> lineList = zhyArticleMapper.selectZhyArticleList(zhyArticle);
|
|
|
for (int i=0;i<lineList.size();i++){ |
|
|
// for (int i=0;i<lineList.size();i++){
|
|
|
String abstracts = lineList.get(i).getName()+lineList.get(i).getKeywords()+lineList.get(i).getSummary(); |
|
|
// String abstracts = lineList.get(i).getName()+lineList.get(i).getKeywords()+lineList.get(i).getSummary();
|
|
|
System.out.println(abstracts); |
|
|
// System.out.println(abstracts);
|
|
|
String id = String.valueOf(lineList.get(i).getId()); |
|
|
// String id = String.valueOf(lineList.get(i).getId());
|
|
|
ZhyDocRelation zhyDocRelation = new ZhyDocRelation(); |
|
|
// ZhyDocRelation zhyDocRelation = new ZhyDocRelation();
|
|
|
zhyDocRelation.setArticleId(lineList.get(i).getId()); |
|
|
// zhyDocRelation.setArticleId(lineList.get(i).getId());
|
|
|
List<Map> a = zhyDocRelationMapper.selectZhyRelationshipArticle(zhyDocRelation); |
|
|
// List<Map> a = zhyDocRelationMapper.selectZhyRelationshipArticle(zhyDocRelation);
|
|
|
List<String> ids = new ArrayList<>(); |
|
|
// List<String> ids = new ArrayList<>();
|
|
|
for (int j = 0;j<a.size();j++){ |
|
|
// for (int j = 0;j<a.size();j++){
|
|
|
ids.add(String.valueOf(a.get(j).get("id"))); |
|
|
// ids.add(String.valueOf(a.get(j).get("id")));
|
|
|
} |
|
|
// }
|
|
|
ESDao esDao = new ESDao(); |
|
|
// ESDao esDao = new ESDao();
|
|
|
esDao.id = id; |
|
|
// esDao.id = id;
|
|
|
esDao.DBid = id; |
|
|
// esDao.DBid = id;
|
|
|
esDao.type = "line"; |
|
|
// esDao.type = "line";
|
|
|
esDao.abstracts = abstracts; |
|
|
// esDao.abstracts = abstracts;
|
|
|
esDao.data = ids.toString(); |
|
|
// esDao.data = ids.toString();
|
|
|
bookList2.add(esDao); |
|
|
// bookList2.add(esDao);
|
|
|
System.out.println(bookList2); |
|
|
// System.out.println(bookList2);
|
|
|
} |
|
|
// }
|
|
|
elasticSearchUtil.addDocBatch("links", bookList2, ESDao.class, "id"); |
|
|
// elasticSearchUtil.addDocBatch("links", bookList2, ESDao.class, "id");
|
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|