Compare commits
No commits in common. "192c9b9b9344f8f1a46d4f3fe6c256f0ebe1ce11" and "b4d0596992123c229dc532a39752642f917aa118" have entirely different histories.
192c9b9b93
...
b4d0596992
|
|
@ -89,10 +89,6 @@ dependencies {
|
||||||
|
|
||||||
implementation 'org.apache.commons:commons-lang3'
|
implementation 'org.apache.commons:commons-lang3'
|
||||||
|
|
||||||
// https://mvnrepository.com/artifact/org.apache.httpcomponents.client5/httpclient5
|
|
||||||
implementation group: 'org.apache.httpcomponents.client5', name: 'httpclient5', version: '5.3.1'
|
|
||||||
// https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple
|
|
||||||
implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,9 +89,6 @@ public class SecurityConfig {
|
||||||
/* 기준코드 조회 */
|
/* 기준코드 조회 */
|
||||||
"/standardCode/**",
|
"/standardCode/**",
|
||||||
|
|
||||||
/* 통합검색 요청 */
|
|
||||||
"/search/doc",
|
|
||||||
|
|
||||||
/* 관련사이트 이미지 조회 */
|
/* 관련사이트 이미지 조회 */
|
||||||
"/admin/config/get-site-image/**"
|
"/admin/config/get-site-image/**"
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
package com.dbnt.kcscbackend.search;
|
|
||||||
|
|
||||||
import com.dbnt.kcscbackend.search.model.DocTitle;
|
|
||||||
import com.dbnt.kcscbackend.search.service.SearchService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.json.simple.JSONArray;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@RequestMapping("/search")
|
|
||||||
public class SearchController {
|
|
||||||
|
|
||||||
private final SearchService searchService;
|
|
||||||
|
|
||||||
@RequestMapping("/doc")
|
|
||||||
public JSONArray searchDoc(
|
|
||||||
@RequestParam(value="target", required = true) String target,
|
|
||||||
@RequestParam(value="searchText", required = true) String text,
|
|
||||||
@RequestParam(value="pageNum", required = false, defaultValue = "1") Integer pageNum,
|
|
||||||
@RequestParam(value="pageSize", required = false, defaultValue = "15") Integer pageSize
|
|
||||||
){
|
|
||||||
return searchService.searchRequest(target, text, pageNum, pageSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
package com.dbnt.kcscbackend.search.model;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@NoArgsConstructor
|
|
||||||
|
|
||||||
public class DocContent {
|
|
||||||
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
private String kcscCd;
|
|
||||||
|
|
||||||
private String docNm;
|
|
||||||
|
|
||||||
private String docYr;
|
|
||||||
|
|
||||||
private String groupTitle;
|
|
||||||
|
|
||||||
private String tableContent;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
package com.dbnt.kcscbackend.search.model;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class DocIndex {
|
|
||||||
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
private String kcscCd;
|
|
||||||
|
|
||||||
private String docNm;
|
|
||||||
|
|
||||||
private String docYr;
|
|
||||||
|
|
||||||
private String groupTitle;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
package com.dbnt.kcscbackend.search.model;
|
|
||||||
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class DocTitle {
|
|
||||||
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
private String kcscCd;
|
|
||||||
|
|
||||||
private String docNm;
|
|
||||||
|
|
||||||
private String docYr;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
package com.dbnt.kcscbackend.search.service;
|
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
|
|
||||||
import org.apache.hc.client5.http.classic.methods.HttpGet;
|
|
||||||
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
|
|
||||||
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
|
|
||||||
import org.apache.hc.client5.http.impl.classic.HttpClients;
|
|
||||||
import org.apache.hc.core5.http.ParseException;
|
|
||||||
import org.apache.hc.core5.http.io.entity.EntityUtils;
|
|
||||||
import org.json.simple.JSONArray;
|
|
||||||
import org.json.simple.parser.JSONParser;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class SearchService {
|
|
||||||
|
|
||||||
|
|
||||||
public JSONArray searchRequest(String target, String text, Integer pageNum, Integer pageSize) {
|
|
||||||
String uri = "http://localhost:8090";
|
|
||||||
switch (target){
|
|
||||||
case "title": uri+="/doc-search/doc-title?";break;
|
|
||||||
case "index": uri+="/doc-search/doc-index?";break;
|
|
||||||
case "content": uri+="/doc-search/doc-content?";break;
|
|
||||||
}
|
|
||||||
String param = "searchText="+URLEncoder.encode(text, StandardCharsets.UTF_8)+"&pageNum="+pageNum+"&pageSize="+pageSize;
|
|
||||||
try{
|
|
||||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
|
||||||
HttpGet httpGet = new HttpGet(uri+param);
|
|
||||||
httpGet.addHeader("User-Agent", "Mozilla/5.0");
|
|
||||||
httpGet.addHeader("Content-type", "application/json;charset=UTF-8");
|
|
||||||
CloseableHttpResponse httpResponse = httpClient.execute(httpGet);
|
|
||||||
String json = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
|
|
||||||
return (JSONArray)new JSONParser().parse(json);
|
|
||||||
} catch (IOException | ParseException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch (org.json.simple.parser.ParseException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -33,8 +33,3 @@ logging.level.com.atoz_develop.mybatissample.repository=TRACE
|
||||||
Globals.posblAtchFileSize=5242880
|
Globals.posblAtchFileSize=5242880
|
||||||
Globals.fileStorePath=D:\\kcscUploadFiles
|
Globals.fileStorePath=D:\\kcscUploadFiles
|
||||||
Globals.addedOptions=false
|
Globals.addedOptions=false
|
||||||
|
|
||||||
#JWT
|
|
||||||
# redisConfig
|
|
||||||
spring.redis.host=localhost
|
|
||||||
spring.redis.port=6379
|
|
||||||
|
|
@ -36,8 +36,3 @@ logging.level.com.atoz_develop.mybatissample.repository=info
|
||||||
Globals.posblAtchFileSize=5242880
|
Globals.posblAtchFileSize=5242880
|
||||||
Globals.fileStorePath=/kcscUploadFiles
|
Globals.fileStorePath=/kcscUploadFiles
|
||||||
Globals.addedOptions=false
|
Globals.addedOptions=false
|
||||||
|
|
||||||
#JWT
|
|
||||||
# redisConfig
|
|
||||||
spring.redis.host=localhost
|
|
||||||
spring.redis.port=6479
|
|
||||||
|
|
@ -6,6 +6,10 @@ spring.mvc.pathmatch.matching-strategy=ant_path_matcher
|
||||||
Globals.pageUnit=10
|
Globals.pageUnit=10
|
||||||
Globals.pageSize=10
|
Globals.pageSize=10
|
||||||
|
|
||||||
|
#JWT
|
||||||
|
# redisConfig
|
||||||
|
spring.redis.host=localhost
|
||||||
|
spring.redis.port=6379
|
||||||
# secret key
|
# secret key
|
||||||
Globals.jwt.secret = qWwMroux3QtiIJcPSIZARNTZEBBnWVH0jZ2Lx7tfFChCYi0ViZllo1bekZdiU0B3FRjJI7g90n0ha120dwlz8JZU8rOkmNCe9Uq0
|
Globals.jwt.secret = qWwMroux3QtiIJcPSIZARNTZEBBnWVH0jZ2Lx7tfFChCYi0ViZllo1bekZdiU0B3FRjJI7g90n0ha120dwlz8JZU8rOkmNCe9Uq0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
package com.dbnt.kcscopensearch.indexing;
|
|
||||||
|
|
||||||
import com.dbnt.kcscopensearch.kcsc.docView.model.DocContentView;
|
|
||||||
import com.dbnt.kcscopensearch.kcsc.docView.model.DocIndexView;
|
|
||||||
import com.dbnt.kcscopensearch.kcsc.docView.model.DocTitleView;
|
|
||||||
import com.dbnt.kcscopensearch.kcsc.docView.service.DocViewService;
|
|
||||||
import com.dbnt.kcscopensearch.opensearch.docSearch.model.DocContent;
|
|
||||||
import com.dbnt.kcscopensearch.opensearch.docSearch.model.DocIndex;
|
|
||||||
import com.dbnt.kcscopensearch.opensearch.docSearch.model.DocTitle;
|
|
||||||
import com.dbnt.kcscopensearch.opensearch.docSearch.service.DocSearchService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@RequestMapping("/indexing")
|
|
||||||
public class IndexingController {
|
|
||||||
private final DocViewService docViewService;
|
|
||||||
private final DocSearchService docSearchService;
|
|
||||||
|
|
||||||
@GetMapping("/doc-title")
|
|
||||||
public String getTitleIndexing(){
|
|
||||||
List<DocTitleView> titleViewList = docViewService.selectAllDocTitle();
|
|
||||||
List<DocTitle> titleList = new ArrayList<>();
|
|
||||||
for(DocTitleView view: titleViewList){
|
|
||||||
titleList.add(new DocTitle(view));
|
|
||||||
}
|
|
||||||
docSearchService.saveDocTitle(titleList);
|
|
||||||
return "OK";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/doc-index")
|
|
||||||
public String getIndexIndexing(){
|
|
||||||
List<DocIndexView> indexViewList = docViewService.selectAllDocIndex();
|
|
||||||
List<DocIndex> indexList = new ArrayList<>();
|
|
||||||
for(DocIndexView view: indexViewList){
|
|
||||||
indexList.add(new DocIndex(view));
|
|
||||||
}
|
|
||||||
docSearchService.saveDocIndex(indexList);
|
|
||||||
return "OK";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/doc-content")
|
|
||||||
public String getContentIndexing(){
|
|
||||||
List<DocContentView> contentViewList = docViewService.selectAllDocContent();
|
|
||||||
List<DocContent> contentList = new ArrayList<>();
|
|
||||||
for(DocContentView view: contentViewList){
|
|
||||||
contentList.add(new DocContent(view));
|
|
||||||
}
|
|
||||||
docSearchService.saveDocContent(contentList);
|
|
||||||
return "OK";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -20,24 +20,15 @@ public class DocSearchController {
|
||||||
private final DocSearchService docSearchService;
|
private final DocSearchService docSearchService;
|
||||||
|
|
||||||
@GetMapping(value="/doc-title", produces = MediaType.APPLICATION_JSON_VALUE)
|
@GetMapping(value="/doc-title", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public List<DocTitle> searchTitle (
|
public List<DocTitle> searchTitle (@RequestParam(value="searchText", required = true) String text, @RequestParam(value="pageNum", required = true) Integer pageNum){
|
||||||
@RequestParam(value="searchText", required = true) String text,
|
return docSearchService.selectDocTitle(text, pageNum);
|
||||||
@RequestParam(value="pageNum", required = false, defaultValue = "1") Integer pageNum,
|
|
||||||
@RequestParam(value="pageSize", required = false, defaultValue = "15") Integer pageSize){
|
|
||||||
return docSearchService.selectDocTitle(text, pageNum, pageSize);
|
|
||||||
}
|
}
|
||||||
@GetMapping(value="/doc-index", produces = MediaType.APPLICATION_JSON_VALUE)
|
@GetMapping(value="/doc-index", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public List<DocIndex> searchIndex (
|
public List<DocIndex> searchIndex (@RequestParam(value="searchText", required = true) String text, @RequestParam(value="pageNum", required = true) Integer pageNum){
|
||||||
@RequestParam(value="searchText", required = true) String text,
|
return docSearchService.selectDocIndex(text, pageNum);
|
||||||
@RequestParam(value="pageNum", required = false, defaultValue = "1") Integer pageNum,
|
|
||||||
@RequestParam(value="pageSize", required = false, defaultValue = "15") Integer pageSize){
|
|
||||||
return docSearchService.selectDocIndex(text, pageNum, pageSize);
|
|
||||||
}
|
}
|
||||||
@GetMapping(value="/doc-content", produces = MediaType.APPLICATION_JSON_VALUE)
|
@GetMapping(value="/doc-content", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public List<DocContent> searchContent (
|
public List<DocContent> searchContent (@RequestParam(value="searchText", required = true) String text, @RequestParam(value="pageNum", required = true) Integer pageNum){
|
||||||
@RequestParam(value="searchText", required = true) String text,
|
return docSearchService.selectDocContent(text, pageNum);
|
||||||
@RequestParam(value="pageNum", required = false, defaultValue = "1") Integer pageNum,
|
|
||||||
@RequestParam(value="pageSize", required = false, defaultValue = "15") Integer pageSize){
|
|
||||||
return docSearchService.selectDocContent(text, pageNum, pageSize);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,15 +123,15 @@ public class DocSearchService {
|
||||||
log.info("contentIndexing end");
|
log.info("contentIndexing end");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DocTitle> selectDocTitle(String text, Integer pageNum, Integer pageSize) {
|
public List<DocTitle> selectDocTitle(String text, Integer pageNum) {
|
||||||
return titleRepository.findByDocNmContains(text, PageRequest.of(pageNum, pageSize));
|
return titleRepository.findByDocNmContains(text, PageRequest.of(pageNum, 20));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DocIndex> selectDocIndex(String text, Integer pageNum, Integer pageSize){
|
public List<DocIndex> selectDocIndex(String text, Integer pageNum){
|
||||||
return indexRepository.findByGroupTitleContains(text, PageRequest.of(pageNum, pageSize));
|
return indexRepository.findByGroupTitleContains(text, PageRequest.of(pageNum, 20));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DocContent> selectDocContent(String text, Integer pageNum, Integer pageSize){
|
public List<DocContent> selectDocContent(String text, Integer pageNum){
|
||||||
return contentRepository.findByTableContentContains(text, PageRequest.of(pageNum, pageSize));
|
return contentRepository.findByTableContentContains(text, PageRequest.of(pageNum, 20));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ public class IndexingScheduler {
|
||||||
private final DocViewService docViewService;
|
private final DocViewService docViewService;
|
||||||
private final DocSearchService docSearchService;
|
private final DocSearchService docSearchService;
|
||||||
|
|
||||||
/*@Scheduled(cron = "40 18 23 * * *")
|
@Scheduled(cron = "40 18 23 * * *")
|
||||||
public void viewIndexing(){
|
public void viewIndexing(){
|
||||||
Map<String, List<?>> viewDataMap = docViewService.selectAllView();
|
Map<String, List<?>> viewDataMap = docViewService.selectAllView();
|
||||||
Map<String, List<?>> indexingDataMap = new HashMap<>();
|
Map<String, List<?>> indexingDataMap = new HashMap<>();
|
||||||
|
|
@ -57,10 +57,12 @@ public class IndexingScheduler {
|
||||||
}
|
}
|
||||||
|
|
||||||
docSearchService.save(indexingDataMap);
|
docSearchService.save(indexingDataMap);
|
||||||
}*/
|
|
||||||
|
|
||||||
@Scheduled(cron = "40 1 2 * * *")
|
//docSearchService.save(indexingDataMap);
|
||||||
public void ScheduledTitleIndexing(){
|
}
|
||||||
|
|
||||||
|
@Scheduled(cron = "40 20 23 * * *")
|
||||||
|
public void titleIndexing(){
|
||||||
List<DocTitleView> titleViewList = docViewService.selectAllDocTitle();
|
List<DocTitleView> titleViewList = docViewService.selectAllDocTitle();
|
||||||
List<DocTitle> titleList = new ArrayList<>();
|
List<DocTitle> titleList = new ArrayList<>();
|
||||||
for(DocTitleView view: titleViewList){
|
for(DocTitleView view: titleViewList){
|
||||||
|
|
@ -68,8 +70,8 @@ public class IndexingScheduler {
|
||||||
}
|
}
|
||||||
docSearchService.saveDocTitle(titleList);
|
docSearchService.saveDocTitle(titleList);
|
||||||
}
|
}
|
||||||
@Scheduled(cron = "40 2 2 * * *")
|
@Scheduled(cron = "40 21 23 * * *")
|
||||||
public void ScheduledIndexIndexing(){
|
public void indexIndexing(){
|
||||||
List<DocIndexView> indexViewList = docViewService.selectAllDocIndex();
|
List<DocIndexView> indexViewList = docViewService.selectAllDocIndex();
|
||||||
List<DocIndex> indexList = new ArrayList<>();
|
List<DocIndex> indexList = new ArrayList<>();
|
||||||
for(DocIndexView view: indexViewList){
|
for(DocIndexView view: indexViewList){
|
||||||
|
|
@ -77,8 +79,8 @@ public class IndexingScheduler {
|
||||||
}
|
}
|
||||||
docSearchService.saveDocIndex(indexList);
|
docSearchService.saveDocIndex(indexList);
|
||||||
}
|
}
|
||||||
@Scheduled(cron = "40 7 2 * * *")
|
@Scheduled(cron = "40 25 23 * * *")
|
||||||
public void ScheduledContentIndexing(){
|
public void contentIndexing(){
|
||||||
List<DocContentView> contentViewList = docViewService.selectAllDocContent();
|
List<DocContentView> contentViewList = docViewService.selectAllDocContent();
|
||||||
List<DocContent> contentList = new ArrayList<>();
|
List<DocContent> contentList = new ArrayList<>();
|
||||||
for(DocContentView view: contentViewList){
|
for(DocContentView view: contentViewList){
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
opensearch.uris=https://localhost:9200
|
|
||||||
opensearch.username=admin
|
|
||||||
opensearch.password=kpbP7ECsaTlgvfmaGNBtORH75QHf7TmJhHZdW7Z7
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
opensearch.uris=https://kcsc.dbnt.co.kr:9200
|
|
||||||
opensearch.username=admin
|
|
||||||
opensearch.password=kpbP7ECsaTlgvfmaGNBtORH75QHf7TmJhHZdW7Z7
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
spring.application.name=kcsc-opensearch
|
spring.application.name=kcsc-opensearch
|
||||||
server.port=8090
|
|
||||||
|
opensearch.uris=https://localhost:9200
|
||||||
|
opensearch.username=admin
|
||||||
|
opensearch.password=kpbP7ECsaTlgvfmaGNBtORH75QHf7TmJhHZdW7Z7
|
||||||
|
|
||||||
spring.datasource-kcsc.driverClassName=org.postgresql.Driver
|
spring.datasource-kcsc.driverClassName=org.postgresql.Driver
|
||||||
spring.datasource-kcsc.jdbcUrl=jdbc:postgresql://118.219.150.34:50503/kcsc
|
spring.datasource-kcsc.jdbcUrl=jdbc:postgresql://118.219.150.34:50503/kcsc
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue