Merge branch 'hylee'

This commit is contained in:
hylee 2022-08-16 10:16:11 +09:00
commit edac8df2ed
5 changed files with 160 additions and 20 deletions

View File

@ -72,20 +72,26 @@ public class SearchServiceImpl implements InitializingBean, SearchService {
@Override
public void afterPropertiesSet() throws Exception {
fieldMap.put(SOLR_CORE.INTRO.getValue(), introFieldSet);
fieldMap.put(SOLR_CORE.POLICY.getValue(), policyFieldSet);
fieldMap.put(SOLR_CORE.SAFETY.getValue(), safetyFieldSet);
fieldMap.put(SOLR_CORE.NOTICE.getValue(), noticeFieldSet);
fieldMap.put(SOLR_CORE.COMMUNITY.getValue(), communityFieldSet);
// fieldMap.put(SOLR_CORE.INTRO.getValue(), introFieldSet);
// fieldMap.put(SOLR_CORE.POLICY.getValue(), policyFieldSet);
// fieldMap.put(SOLR_CORE.SAFETY.getValue(), safetyFieldSet);
// fieldMap.put(SOLR_CORE.NOTICE.getValue(), noticeFieldSet);
// fieldMap.put(SOLR_CORE.COMMUNITY.getValue(), communityFieldSet);
System.out.println(" :: SOLR_CORE.INFO.getValue() :: " + SOLR_CORE.INFO.getValue());
System.out.println(" :: infoFieldSet :: " + infoFieldSet);
fieldMap.put(SOLR_CORE.INFO.getValue(), infoFieldSet);
/*fieldMap.put(SOLR_CORE.FILE.getValue(), fileFieldSet);
fieldMap.put(SOLR_CORE.WEBPAGE.getValue(), webpageFieldSet);
fieldMap.put(SOLR_CORE.BOARD.getValue(), boardFieldSet);
fieldMap.put(SOLR_CORE.ITN_BOARD.getValue(), itn_BoardFieldSet);
fieldMap.put(SOLR_CORE.ITN_CONTENT.getValue(), itn_ContentFieldSet);*/
}
/*
* q 가장 중요한 파라미터로 찾고자하는 필드와 값을 설정한다.
* fq 검색 결과를 필터링하는 파라미터이다. 검색결과들 파라미터값에 매칭되는 것들만 리턴한다.
* sort 검색 결과를 정렬할 사용한다. 숫자나 알파벳의 오름차순, 내림차순으로 정렬할 있다.
* rows 번의 검색에서 반환받을 문서의 최대값을 설정한다. 기본값은 10이다.
* fl 반환되는 문서에 포함시킬 필드를 정의할 있다. 설정하지 않으면 모든 필드가 보여진다.
* wt Solr가 사용할 ResponseWriter 객체를 설정한다. 객체에 따라 결과가 보여지는 형식이 달라진다. 기본값은 json이다.
*
* // http://192.168.0.125:8983/solr/kcc_adr_advc/select?q=*:*&wt=json&indent=true
* */
@Override
public Set<String> suggest(Map<String, Object> commandMap) throws Exception {
String q = (String)commandMap.get("q");
@ -100,6 +106,7 @@ public class SearchServiceImpl implements InitializingBean, SearchService {
query.setQuery(q);
String serverUrl = SERVER_URL.endsWith("/") ? SERVER_URL : SERVER_URL + "/";
for(SOLR_CORE sc : SOLR_CORE.values()){
SolrClient client = null;
try {
@ -137,6 +144,10 @@ public class SearchServiceImpl implements InitializingBean, SearchService {
}
}
System.out.println(" :: SOLR_CORE.values().length :: "+ SOLR_CORE.values().length);
System.out.println(" :: SOLR_CORE.values() :: "+ SOLR_CORE.values());
Map<String, List<Map<String, Object>>> resultMap = new HashMap<String, List<Map<String, Object>>>();
Map<String, Long> resultCntMap = new HashMap<String, Long>();
long totalCount = 0;
@ -168,7 +179,7 @@ public class SearchServiceImpl implements InitializingBean, SearchService {
String serverUrl = SERVER_URL.endsWith("/") ? SERVER_URL : SERVER_URL + "/";
HttpSolrClient client = null;
SolrQuery query = makeQuery(core, commandMap, fieldSet);
log.debug("{}{}", serverUrl, query);
log.debug("{} {}", serverUrl, query);
try {
client = new HttpSolrClient(serverUrl+core.getValue());
client.setConnectionTimeout(1000);

View File

@ -8,12 +8,12 @@ import org.springframework.ui.ModelMap;
public interface SearchService {
public static enum SOLR_CORE {
INTRO("재단소개","intro"),
POLICY("정책연구","policy"),
SAFETY("안전교육","safety"),
NOTICE("알림정보","notice"),
COMMUNITY("소통참여","community"),
INFO("정보공개","info");
// INTRO("재단소개","intro"),
// POLICY("정책연구","policy"),
// SAFETY("안전교육","safety"),
// NOTICE("알림정보","notice"),
// COMMUNITY("소통참여","community"),
INFO("정보공개","kcc_adr_advc");
private String name;
private String value;

View File

@ -26,12 +26,15 @@ public class SearchContorller {
@Resource(name = "searchService")
protected SearchService searchService;
//TODO test URL
// http://192.168.0.125:8983/solr/kcc_adr_advc/select?q=*:*&wt=json&indent=true
@SuppressWarnings("unchecked")
@RequestMapping(value = "/web/search/search.do")
public String search(@RequestParam Map<String, Object> commandMap, ModelMap model) throws Exception {
log.debug("commandMap : {}", commandMap);
String searchWrd = (String) commandMap.get("q");
if (searchWrd!= null && !("").equals(searchWrd)) {
searchService.search(commandMap, model);
}

View File

@ -95,7 +95,8 @@ Globals.MainPage = /cmm/main/mainPage.do
Globals.ckeditorUploadDir=/usr/local/tomcat/file/ckeditor/
#TEST SERVER
Globals.RealCntFileFolder=C:/eGovFrameDev-3.9.0-64bit_ncms/workspace/ncms39/src/main/webapp/WEB-INF/jsp/cnt/
Globals.Solr.url=http://localhost:8983/solr
Globals.Solr.url=http://192.168.0.125:8983/solr
#Globals.Solr.url=http://localhost:8983/solr
#SNS \ub85c\uadf8\uc778 KEY \uac12
#ITN \ub124\uc774\ubc84

View File

@ -6,3 +6,128 @@
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<un:useConstants var="KccadrStatus" className="kcc.kccadr.cmm.KccadrConstants" />
<!DOCTYPE html>
<html lang="ko">
<head>
<title>조정사건 목록</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="/kccadrPb/usr/datepicker/classic.css">
<link rel="stylesheet" href="/kccadrPb/usr/datepicker/classic.date.css">
<script src="/kccadrPb/usr/script/popup.js"></script>
<script src="/kccadrPb/usr/datepicker/picker.js"></script>
<script src="/kccadrPb/usr/datepicker/picker.date.js"></script>
<script src="/kccadrPb/usr/datepicker/legacy.js"></script>
<script src="/kccadrPb/usr/datepicker/ko_KR.js"></script>
<script type="text/javaScript" language="javascript">
function fncStatusList(status){
document.listForm.searchStatus.value = status;
document.listForm.searchCondition.value = '';
document.listForm.searchKeyword.value = '';
linkPage(1);
}
function fncGoList(){
var listForm = document.listForm ;
// listForm.pageIndex.value = pageNo ;
listForm.action = "<c:url value='/web/search/search.do'/>";
listForm.submit();
}
function linkPage(pageNo){
var listForm = document.listForm ;
// listForm.pageIndex.value = pageNo ;
listForm.action = "<c:url value='/web/search/search.do'/>";
listForm.submit();
}
</script>
</head>
<body>
<!-- <form:form id="listForm" name="listForm" commandName="adjstIncidentVO" onsubmit="return false;" method="post"> -->
<form id="listForm" name="listForm" onsubmit="return false;" method="post">
<%-- <input type="hidden" name="pageIndex" value="<c:out value='${adjstIncidentVO.pageIndex}' default='1' />"/> --%>
<%-- <input type="hidden" name="searchSortCnd" value="<c:out value="${adjstIncidentVO.searchSortCnd}" />" /> --%>
<%-- <input type="hidden" name="searchSortOrd" value="<c:out value="${adjstIncidentVO.searchSortOrd}" />" /> --%>
<%-- <input type="hidden" name="searchStatus" value="<c:out value="${adjstIncidentVO.searchStatus}" />" /> --%>
<!-- <input type="hidden" name="adrSeq" value="" /> -->
<!-- <input type="hidden" name="adrSn" value="" /> -->
<!-- cont -->
<div class="cont_wrap sub02_1" id="sub">
<div class="inner">
<div class="cont_tit">
<h2>통합검색 TEST</h2>
</div>
<p>name="q" 검색어 : <input type="text" name="q" value=":"/></p>
<p>name="rangeView" 카테고리 : <input type="text" name="rangeView" value="kcc_adr_advc"/></p>
<!-- list_top -->
<div class="list_top">
<!-- <p>총 건수 : <span>204</span>건</p> -->
<div class="list_util">
<label for="searchCondition">검색조건 선택</label>
<div class="select_wrap">
<label for="searchSelStatus">조정상태 선택</label>
<kc:select codeId="CC022" name="searchSelStatus" id="searchSelStatus" defaultValue="" defaultText="선택" selectedValue="${adjstIncidentVO.searchSelStatus}" between="201010,309050" styleClass="select_status"/>
</div>
<div class="input_wrap">
<label for="searchKeyword">검색어 입력</label>
<input type="text" class="search_input" id=searchKeyword name="searchKeyword" placeholder="검색어를 입력하세요" value="<c:out value='${adjstIncidentVO.searchKeyword}'/>">
</div>
<button class="btn_search" onclick="fncGoList();">검색</button>
</div>
</div>
<!-- //list_top -->
<!-- list -->
<div class="tb_list01">
<table>
<colgroup>
<col style="width: 80px;">
<col style="width: 12%;">
<col style="width: 12%;">
<col style="width: 12%;">
<col style="width: auto;">
<col style="width: 12%;">
<col style="width: 12%;">
<col style="width: 12%;">
<col style="width: 140px;">
</colgroup>
<thead>
<tr>
<th scope="col">번호<%--<button class="sort btn_sort" id="sort_ADR_SEQ">▲</button>--%></th>
<th scope="col">접수일자<%--<button type="button" class="sort sortBtn" id="sort_SBMT_DE"></button>--%></th>
<th scope="col">신청인<%--<button type="button" class="sort sortBtn" id="sort_APPLI_CANT_NM"></button>--%></th>
<th scope="col">피신청인<%--<button type="button" class="sort sortBtn" id="sort_RES_PON_DENT_NM"></button>--%></th>
<th scope="col">신청내용<%--<button type="button" class="sort sortBtn" id="sort_DEPU_TY_NM"></button>--%></th>
<th scope="col">조정부<%--<button type="button" class="sort sortBtn" id="sort_REQ_CN1"></button>--%></th>
<th scope="col">기일<%--<button type="button" class="sort sortBtn" id="sort_REQ_CN1"></button>--%></th>
<th scope="col">조정차수<%--<button type="button" class="sort sortBtn" id="sort_REQ_CN1"></button>--%></th>
<th scope="col">조정상태<%--<button type="button" class="sort sortBtn" id="sort_STAT_CD"></button>--%></th>
</tr>
</thead>
<tbody>
<c:if test="${empty list}">
<tr><td colspan="9"><spring:message code="common.nodata.msg" /></td></tr>
</c:if>
</tbody>
</table>
</div>
<!-- //list -->
<!-- page -->
<div class="page">
<%-- <ui:pagination paginationInfo = "${paginationInfo}" type="image" jsFunction="linkPage" /> --%>
</div>
<!-- //page -->
</div>
</form:form>
</div>
</body>
</html>
</body>