diff --git a/src/main/java/egovframework/com/cmm/ComDefaultCodeVO.java b/src/main/java/egovframework/com/cmm/ComDefaultCodeVO.java
new file mode 100644
index 00000000..04e5518a
--- /dev/null
+++ b/src/main/java/egovframework/com/cmm/ComDefaultCodeVO.java
@@ -0,0 +1,185 @@
+package egovframework.com.cmm;
+
+import java.io.Serializable;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 클래스
+ * @author 공통서비스개발팀 이삼섭
+ * @since 2009.06.01
+ * @version 1.0
+ * @see
+ *
+ *
+ * << 개정이력(Modification Information) >>
+ *
+ * 수정일 수정자 수정내용
+ * ------- -------- ---------------------------
+ * 2009.3.11 이삼섭 최초 생성
+ *
+ *
+ */
+@SuppressWarnings("serial")
+public class ComDefaultCodeVO implements Serializable {
+ /** 코드 ID */
+ private String codeId = "";
+
+ /** 상세코드 */
+ private String code = "";
+
+ /** 코드명 */
+ private String codeNm = "";
+
+ /** 코드설명 */
+ private String codeDc = "";
+
+ /** 특정테이블명 */
+ private String tableNm = ""; //특정테이블에서 코드정보를추출시 사용
+
+ /** 상세 조건 여부 */
+ private String haveDetailCondition = "N";
+
+ /** 상세 조건 */
+ private String detailCondition = "";
+
+ /**
+ * codeId attribute를 리턴한다.
+ *
+ * @return the codeId
+ */
+ public String getCodeId() {
+ return codeId;
+ }
+
+ /**
+ * codeId attribute 값을 설정한다.
+ *
+ * @param codeId
+ * the codeId to set
+ */
+ public void setCodeId(String codeId) {
+ this.codeId = codeId;
+ }
+
+ /**
+ * code attribute를 리턴한다.
+ *
+ * @return the code
+ */
+ public String getCode() {
+ return code;
+ }
+
+ /**
+ * code attribute 값을 설정한다.
+ *
+ * @param code
+ * the code to set
+ */
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ /**
+ * codeNm attribute를 리턴한다.
+ *
+ * @return the codeNm
+ */
+ public String getCodeNm() {
+ return codeNm;
+ }
+
+ /**
+ * codeNm attribute 값을 설정한다.
+ *
+ * @param codeNm
+ * the codeNm to set
+ */
+ public void setCodeNm(String codeNm) {
+ this.codeNm = codeNm;
+ }
+
+ /**
+ * codeDc attribute를 리턴한다.
+ *
+ * @return the codeDc
+ */
+ public String getCodeDc() {
+ return codeDc;
+ }
+
+ /**
+ * codeDc attribute 값을 설정한다.
+ *
+ * @param codeDc
+ * the codeDc to set
+ */
+ public void setCodeDc(String codeDc) {
+ this.codeDc = codeDc;
+ }
+
+ /**
+ * tableNm attribute를 리턴한다.
+ *
+ * @return the tableNm
+ */
+ public String getTableNm() {
+ return tableNm;
+ }
+
+ /**
+ * tableNm attribute 값을 설정한다.
+ *
+ * @param tableNm
+ * the tableNm to set
+ */
+ public void setTableNm(String tableNm) {
+ this.tableNm = tableNm;
+ }
+
+ /**
+ * haveDetailCondition attribute를 리턴한다.
+ *
+ * @return the haveDetailCondition
+ */
+ public String getHaveDetailCondition() {
+ return haveDetailCondition;
+ }
+
+ /**
+ * haveDetailCondition attribute 값을 설정한다.
+ *
+ * @param haveDetailCondition
+ * the haveDetailCondition to set
+ */
+ public void setHaveDetailCondition(String haveDetailCondition) {
+ this.haveDetailCondition = haveDetailCondition;
+ }
+
+ /**
+ * detailCondition attribute를 리턴한다.
+ *
+ * @return the detailCondition
+ */
+ public String getDetailCondition() {
+ return detailCondition;
+ }
+
+ /**
+ * detailCondition attribute 값을 설정한다.
+ *
+ * @param detailCondition
+ * the detailCondition to set
+ */
+ public void setDetailCondition(String detailCondition) {
+ this.detailCondition = detailCondition;
+ }
+
+ /**
+ * toString 메소드를 대치한다.
+ */
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+}
diff --git a/src/main/java/kccf/sch/common/WNAnchor.java b/src/main/java/kccf/sch/common/WNAnchor.java
new file mode 100644
index 00000000..4ca84146
--- /dev/null
+++ b/src/main/java/kccf/sch/common/WNAnchor.java
@@ -0,0 +1,108 @@
+package kccf.sch.common;
+
+public class WNAnchor {
+ private int m_before = -1;
+ private int m_next = -1;
+ private int m_bundleBefore = -1;
+ private int m_bundleNext = -1;
+ private int m_firstPage = -1;
+ private int m_lastPage = -1;
+ private int m_totalPgCount = 0;
+ private int m_totlalBundlePgCount = 0;
+ private int m_pageCount = 0;
+ private int m_curPageNumber = 1;
+ private String[][] m_pages = new String[1][2];
+
+ public WNAnchor() {
+ m_pages[0][0] = "1";
+ m_pages[0][1] = "-1";
+ }
+
+ public int getBefore() {
+ return m_before;
+ }
+
+ public void setBefore(int before) {
+ m_before = before;
+ }
+
+ public int getFirstPage() {
+ return m_firstPage;
+ }
+
+ public void setFirstPage(int firstPage) {
+ m_firstPage = firstPage;
+ }
+
+ public int getLastPage() {
+ return m_lastPage;
+ }
+
+ public void setLastPage(int lastPage) {
+ m_lastPage = lastPage;
+ }
+
+ public int getNext() {
+ return m_next;
+ }
+
+ public void setNext(int next) {
+ m_next = next;
+ }
+
+ public int getBundleBefore() {
+ return m_bundleBefore;
+ }
+
+ public void setBundleBefore(int bundleBefore) {
+ m_bundleBefore = bundleBefore;
+ }
+
+ public int getBundleNext() {
+ return m_bundleNext;
+ }
+
+ public void setBundleNext(int bundleNext) {
+ m_bundleNext = bundleNext;
+ }
+
+ public int getTotalPgCount() {
+ return m_totalPgCount;
+ }
+
+ public void setTotalPgCount(int totalPgCount) {
+ m_totalPgCount = totalPgCount;
+ }
+
+ public int getTotlalBundlePgCount() {
+ return m_totlalBundlePgCount;
+ }
+
+ public void setTotlalBundlePgCount(int totlalBundlePgCount) {
+ m_totlalBundlePgCount = totlalBundlePgCount;
+ }
+
+ public int getPageCount() {
+ return m_pageCount;
+ }
+
+ public void setPageCount(int pageCount) {
+ m_pageCount = pageCount;
+ }
+
+ public int getCurPageNumber() {
+ return m_curPageNumber;
+ }
+
+ public void setCurPageNumber(int curPageNumber) {
+ m_curPageNumber = curPageNumber;
+ }
+
+ public String[][] getPages() {
+ return m_pages;
+ }
+
+ public void setPages(String[][] pages) {
+ m_pages = pages;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/kccf/sch/common/WNCollection.java b/src/main/java/kccf/sch/common/WNCollection.java
new file mode 100644
index 00000000..58e87f6b
--- /dev/null
+++ b/src/main/java/kccf/sch/common/WNCollection.java
@@ -0,0 +1,335 @@
+package kccf.sch.common;
+
+public class WNCollection {
+
+
+ public static String[] COLLECTIONS = new String[]{"info","map","number","pick","reference","story","culturePost","total","culturePostHot","toon","ocr"};
+ public static String[] COLLECTIONS_NAME = new String[]{"info","map","number","pick","reference","story","culturePost","total","culturePostHot","toon","ocr"};
+ public static String[] MERGE_COLLECTIONS = new String[]{""};
+ public String[][] MERGE_COLLECTION_INFO = null;
+ public String[][] COLLECTION_INFO = null;
+ public WNCollection(){
+ COLLECTION_INFO = new String[][]
+ {
+ {
+ "info", // set index name
+ "info", // set collection name
+ "0,3", // set pageinfo (start,count)
+ "1,0,0,1,0", // set query analyzer (useKMA,isCase,useOriginal,useSynonym, duplcated detection)
+ "RANK/DESC,DATE/DESC", // set sort field (field,order) multi sort '/'
+ "basic,rpfmo,100", // set sort field (field,order) multi sort '/'
+ "TITLE,CONTENT_TYPE_NAME_EX,SIDO_NAME",// set search field
+ "DOCID,DATE,CONT_TYPE,CAT1_NAME,GIA_CAT2_NAME,CAT3_NAME,CONTENT_ID,CONTENT_TYPE_ID,CONTENT_TYPE_NAME,TITLE,SIDO_NAME,SIGUNGU_NAME,SEARCH_AREA,MAIN_IMG,ADDR1,ZIP_CODE,TEL,ALIAS,SEARCH_AREA_COUNCIL,SEARCH_AREA_COUNCIL_INFO",// set document field
+ "", // set date range
+ "", // set rank range
+ "", // set prefix query, example: |/1, (fieldname:contains:value) and ' ', or '|', not '!' / operator (AND:1, OR:0)
+ "", // set collection query (/option...) and ' ', or '|'
+ "", // set boost query ( | ...) and ' ', or '|'
+ "", // set filter operation ()
+ "", // set groupby field(field, count)
+ "", // set sort field group(field/order,field/order,...)
+ "", // set categoryBoost(fieldname,matchType,boostID,boostKeyword)
+ "", // set categoryGroupBy (fieldname:value)
+ "", // set categoryQuery (fieldname:value)
+ "", // set property group (fieldname,min,max, groupcount)
+ "CONTENT_TYPE_NAME,SEARCH_AREA_COUNCIL_INFO", // use check prefix query filed
+ "", // set use check fast access field
+ "", // set multigroupby field
+ "", // set auth query (Auth Target Field, Auth Collection, Auth Reference Field, Authority Query)
+ "", // set Duplicate Detection Criterion Field, RANK/DESC,DATE/DESC
+ "info" // collection display name
+ }
+ ,
+ {
+ "map", // set index name
+ "map", // set collection name
+ "0,3", // set pageinfo (start,count)
+ "1,0,0,1,0", // set query analyzer (useKMA,isCase,useOriginal,useSynonym, duplcated detection)
+ "RANK/DESC,DATE/DESC", // set sort field (field,order) multi sort '/'
+ "basic,rpfmo,100", // set sort field (field,order) multi sort '/'
+ "TITLE,TRS_AGE_EX,INTERFACE_ID,GENYEAR_SCH,CHRONOLOGICAL_START_SCH,CHRONOLOGICAL_END_SCH,FIRST_TOPIC,SECOND_TOPIC,FIRST_CLASS,SECOND_CLASS,THEME_CD,THEME_NM,SERIES_CD,SERIES_NM",// set search field
+ "DOCID,DATE,CONTENT_TYPE,CONTENT_ID,TITLE,SUMMARY,MAIN_IMG,ADDR1,LATITUDE,LONGITUDE,LINK_DATA,READ_CNT,INTERFACE_ID,GENYEAR,TRS_AGE,CHRONOLOGICAL_START,CHRONOLOGICAL_END,FIRST_TOPIC,SECOND_TOPIC,FIRST_CLASS,SECOND_CLASS,SIDO_NAME,SIGUNGU_NAME,ADDR2,THEME_CD,THEME_NM,SERIES_CD,SERIES_NM,CONTENT_TYPE_ID,ID,FIRST_CATEGORY,SECOND_CATEGORY,FIRST_CATEGORY_NM,SECOND_CATEGORY_NM,TAGS_NAME,CONTENT_TYPE_NAME,CAT1,CAT1_NAME,CAT2,CAT2_NAME,CAT3,CAT3_NAME,ZIP_CODE,TEL,RECOMMEND_YN,NTCE_BGNDE,NTCE_ENDDE,WEBSITE,UPDATED_AT,COUNCIL_CD,COUNCIL_NM,ALIAS,GENYEAR_SCH,CHRONOLOGICAL_START_SCH,CHRONOLOGICAL_END_SCH",// set document field
+ "", // set date range
+ "", // set rank range
+ "", // set prefix query, example: |/1, (fieldname:contains:value) and ' ', or '|', not '!' / operator (AND:1, OR:0)
+ "", // set collection query (/option...) and ' ', or '|'
+ "", // set boost query ( | ...) and ' ', or '|'
+ "", // set filter operation ()
+ "", // set groupby field(field, count)
+ "", // set sort field group(field/order,field/order,...)
+ "", // set categoryBoost(fieldname,matchType,boostID,boostKeyword)
+ "", // set categoryGroupBy (fieldname:value)
+ "", // set categoryQuery (fieldname:value)
+ "", // set property group (fieldname,min,max, groupcount)
+ "TRS_AGE,CONTENT_TYPE", // use check prefix query filed
+ "READ_CNT,GENYEAR,CHRONOLOGICAL_START,CHRONOLOGICAL_END", // set use check fast access field
+ "", // set multigroupby field
+ "", // set auth query (Auth Target Field, Auth Collection, Auth Reference Field, Authority Query)
+ "", // set Duplicate Detection Criterion Field, RANK/DESC,DATE/DESC
+ "map" // collection display name
+ }
+ ,
+ {
+ "number", // set index name
+ "number", // set collection name
+ "0,3", // set pageinfo (start,count)
+ "1,0,0,1,0", // set query analyzer (useKMA,isCase,useOriginal,useSynonym, duplcated detection)
+ "RANK/DESC,DATE/DESC", // set sort field (field,order) multi sort '/'
+ "basic,rpfmo,100", // set sort field (field,order) multi sort '/'
+ "TAGS,TITLE,INTERFACE_ID,GENYEAR_SCH,TRS_AGE_EX,CHRONOLOGICAL_START_SCH,CHRONOLOGICAL_END_SCH,FIRST_CATEGORY_NM,SECOND_CATEGORY_NM,FIRST_CLASS_NM,SECOND_CLASS_NM,FIRST_TOPIC,SECOND_TOPIC,THEME_CD_EX,THEME_NM_EX,SERIES_CD_EX,SERIES_NM_EX",// set search field
+ "DOCID,DATE,TITLE,SUMMARY,THEME_CD,THEME_NM,SERIES_CD,SERIES_NM,SIDO_NAME,SIGUNGU_NAME,LINK_DATA,FIRST_TOPIC,SECOND_TOPIC,FIRST_CLASS,SECOND_CLASS,SOJANG_COUNCIL,TAGS,COUNCIL,KEYWORDS,INTERFACE_ID,GENYEAR,TRS_AGE,CHRONOLOGICAL_START,CHRONOLOGICAL_END,FIRST_CATEGORY,SECOND_CATEGORY,READ_CNT,CONTENT_ID,CONTENT_TYPE,ID,SEARCH_THEME_CD,SEARCH_THEME_NM,SEARCH_CLASS,FIRST_CATEGORY_NM,SECOND_CATEGORY_NM,SOJANG_COUNCIL_NM,FIRST_CLASS_NM,SECOND_CLASS_NM,MEDIA_ID,ASSET_CLASS,ALIAS,SEARCH_AREA_COUNCIL,GENYEAR_SCH,CHRONOLOGICAL_START_SCH,CHRONOLOGICAL_END_SCH,COUNCIL_NM_TOT,ASSET_TYPE,MAIN_IMG",// set document field
+ "", // set date range
+ "", // set rank range
+ "", // set prefix query, example: |/1, (fieldname:contains:value) and ' ', or '|', not '!' / operator (AND:1, OR:0)
+ "", // set collection query (/option...) and ' ', or '|'
+ "", // set boost query ( | ...) and ' ', or '|'
+ "", // set filter operation ()
+ "", // set groupby field(field, count)
+ "", // set sort field group(field/order,field/order,...)
+ "", // set categoryBoost(fieldname,matchType,boostID,boostKeyword)
+ "", // set categoryGroupBy (fieldname:value)
+ "", // set categoryQuery (fieldname:value)
+ "", // set property group (fieldname,min,max, groupcount)
+ "TRS_AGE,FIRST_CLASS,SECOND_CLASS,THEME_CD,THEME_NM,SEARCH_THEME_CD,SEARCH_THEME_NM,SOJANG_COUNCIL,KEYWORDS,SIDO_NAME,SERIES_CD,SERIES_NM", // use check prefix query filed
+ "GENYEAR,CHRONOLOGICAL_START,CHRONOLOGICAL_END,READ_CNT", // set use check fast access field
+ "", // set multigroupby field
+ "", // set auth query (Auth Target Field, Auth Collection, Auth Reference Field, Authority Query)
+ "", // set Duplicate Detection Criterion Field, RANK/DESC,DATE/DESC
+ "number" // collection display name
+ }
+ ,
+ {
+ "pick", // set index name
+ "pick", // set collection name
+ "0,3", // set pageinfo (start,count)
+ "1,0,0,1,0", // set query analyzer (useKMA,isCase,useOriginal,useSynonym, duplcated detection)
+ "RANK/DESC,DATE/DESC", // set sort field (field,order) multi sort '/'
+ "basic,rpfmo,100", // set sort field (field,order) multi sort '/'
+ "TITLE,SUMMARY,INTERFACE_ID,GENYEAR_SCH,TRS_AGE_EX,CHRONOLOGICAL_START_SCH,CHRONOLOGICAL_END_SCH,FIRST_CATEGORY_NM,SECOND_CATEGORY_NM,FIRST_CLASS_NM,SECOND_CLASS_NM,THEME,SERIES,COUNCIL,KEYWORDS_EX,TAGS,OCR_TEXT_TOT",// set search field
+ "DOCID,DATE,TITLE,SUMMARY,FIRST_CLASS,SECOND_CLASS,SOJANG_COUNCIL,TAGS,KEYWORDS,READ_CNT,INTERFACE_ID,GENYEAR,TRS_AGE,CHRONOLOGICAL_START,CHRONOLOGICAL_END,FIRST_CATEGORY,SECOND_CATEGORY,SEARCH_CLASS,AUTHOR,PUBLISHER,FIRST_CATEGORY_NM,SECOND_CATEGORY_NM,COUNCIL,SIDO_NAME,SIGUNGU_NAME,TRS_SIDO_NAME,TRS_SIGUNGU_NAME,FIRST_CLASS_NM,SECOND_CLASS_NM,SEARCH_AREA_COUNCIL,LINK_DATA,ASSETS_ID,MEDIA_ID,MAIN_IMG,MGNT_NO,ASSET_TYPE,THEME,SERIES,ORG_OPEN_AT,STRE_FILE_NAME,ALIAS,SUBTITLE,ADDITION,ORIGNL_FILE_NAME,FILE_SIZE,WIDTH,HEIGHT,IMG_ALT,MEDIA_TYPE,PLAYER_AT,PLAY_TIME,VOLUME,TOTAL_PAGE,ISBN,WEBSITE_NAME,LINK_USE_AT,MAKING_DATE,FILMING_LOCATION,SUBTITLE_AT,SUBTITLE_ORG_FILE_NAME,SUBTITLE_STRE_FILE_NAME,SUBTITLE_DESC,PROVIDER,SOURCE_AT,SOURCE,COPYRIGHT,RETENTION_PERIOD,COPYRIGHT_MGNT_DEPART,THIRD_COPYRIGHT,CCL_TYPE,UPDATED_AT,DELETED_AT,USE_AT,REMARKS_DESC,RECOMMEND_YN,GENYEAR_SCH,CHRONOLOGICAL_START_SCH,CHRONOLOGICAL_END_SCH,COUNCIL_NM_TOT,OCR_TEXT_TOT",// set document field
+ "", // set date range
+ "", // set rank range
+ "", // set prefix query, example: |/1, (fieldname:contains:value) and ' ', or '|', not '!' / operator (AND:1, OR:0)
+ "", // set collection query (/option...) and ' ', or '|'
+ "", // set boost query ( | ...) and ' ', or '|'
+ "", // set filter operation ()
+ "", // set groupby field(field, count)
+ "", // set sort field group(field/order,field/order,...)
+ "", // set categoryBoost(fieldname,matchType,boostID,boostKeyword)
+ "", // set categoryGroupBy (fieldname:value)
+ "", // set categoryQuery (fieldname:value)
+ "", // set property group (fieldname,min,max, groupcount)
+ "TRS_AGE,FIRST_CATEGORY,SECOND_CATEGORY,FIRST_CLASS,SECOND_CLASS,SOJANG_COUNCIL,MGNT_NO,KEYWORDS,SIDO_NAME,MEDIA_ID,ASSET_TYPE,ASSETS_ID", // use check prefix query filed
+ "READ_CNT,GENYEAR,CHRONOLOGICAL_START,CHRONOLOGICAL_END", // set use check fast access field
+ "", // set multigroupby field
+ "", // set auth query (Auth Target Field, Auth Collection, Auth Reference Field, Authority Query)
+ "", // set Duplicate Detection Criterion Field, RANK/DESC,DATE/DESC
+ "pick" // collection display name
+ }
+ ,
+ {
+ "reference", // set index name
+ "reference", // set collection name
+ "0,3", // set pageinfo (start,count)
+ "1,0,0,1,0", // set query analyzer (useKMA,isCase,useOriginal,useSynonym, duplcated detection)
+ "RANK/DESC,DATE/DESC", // set sort field (field,order) multi sort '/'
+ "custom,rweight=0.7;dweight=0.2;fweight=0.1,0", // set sort field (field,order) multi sort '/'
+ "TITLE/5,SUMMARY,INTERFACE_ID,GENYEAR_SCH,TRS_AGE_EX,CHRONOLOGICAL_START_SCH,CHRONOLOGICAL_END_SCH,FIRST_CATEGORY_NM,SECOND_CATEGORY_NM,FIRST_CLASS_NM,SECOND_CLASS_NM,THEME,SERIES,COUNCIL,KEYWORDS_EX,TAGS,OCR_TEXT_TOT",// set search field
+ "DOCID,DATE,TITLE,SUMMARY,FIRST_CLASS,SECOND_CLASS,SOJANG_COUNCIL,TAGS,KEYWORDS,READ_CNT,INTERFACE_ID,GENYEAR,TRS_AGE,CHRONOLOGICAL_START,CHRONOLOGICAL_END,FIRST_CATEGORY,SECOND_CATEGORY,SEARCH_CLASS,SEARCH_CATEGORY,AUTHOR,PUBLISHER,FIRST_CATEGORY_NM,SECOND_CATEGORY_NM,COUNCIL,SIDO_NAME,SIGUNGU_NAME,TRS_SIDO_NAME,TRS_SIGUNGU_NAME,FIRST_CLASS_NM,SECOND_CLASS_NM,SEARCH_AREA_COUNCIL,LINK_DATA,ASSETS_ID,MEDIA_ID,MAIN_IMG,MGNT_NO,ASSET_TYPE,THEME,SERIES,ORG_OPEN_AT,STRE_FILE_NAME,ALIAS,SUBTITLE,ADDITION,ORIGNL_FILE_NAME,FILE_SIZE,WIDTH,HEIGHT,IMG_ALT,MEDIA_TYPE,PLAYER_AT,PLAY_TIME,VOLUME,TOTAL_PAGE,ISBN,WEBSITE_NAME,LINK_USE_AT,MAKING_DATE,FILMING_LOCATION,SUBTITLE_AT,SUBTITLE_ORG_FILE_NAME,SUBTITLE_STRE_FILE_NAME,SUBTITLE_DESC,PROVIDER,SOURCE_AT,SOURCE,COPYRIGHT,RETENTION_PERIOD,COPYRIGHT_MGNT_DEPART,THIRD_COPYRIGHT,CCL_TYPE,UPDATED_AT,DELETED_AT,USE_AT,REMARKS_DESC,RECOMMEND_YN,GENYEAR_SCH,CHRONOLOGICAL_START_SCH,CHRONOLOGICAL_END_SCH,OCR_TEXT_TOT,COUNCIL_NM_TOT,TABLE_OF_CONTENTS,ORG_OPEN_EXIST,MAIN_IMG_EXIST",// set document field
+ "", // set date range
+ "", // set rank range
+ "", // set prefix query, example: |/1, (fieldname:contains:value) and ' ', or '|', not '!' / operator (AND:1, OR:0)
+ "", // set collection query (/option...) and ' ', or '|'
+ "", // set boost query ( | ...) and ' ', or '|'
+ "", // set filter operation ()
+ "", // set groupby field(field, count)
+ "", // set sort field group(field/order,field/order,...)
+ "", // set categoryBoost(fieldname,matchType,boostID,boostKeyword)
+ "", // set categoryGroupBy (fieldname:value)
+ "", // set categoryQuery (fieldname:value)
+ "", // set property group (fieldname,min,max, groupcount)
+ "TRS_AGE,FIRST_CATEGORY,SECOND_CATEGORY,FIRST_CLASS,SECOND_CLASS,SOJANG_COUNCIL,MGNT_NO,KEYWORDS,SIDO_NAME,MEDIA_ID,ASSET_TYPE,ASSETS_ID", // use check prefix query filed
+ "READ_CNT,GENYEAR,CHRONOLOGICAL_START,CHRONOLOGICAL_END", // set use check fast access field
+ "", // set multigroupby field
+ "", // set auth query (Auth Target Field, Auth Collection, Auth Reference Field, Authority Query)
+ "", // set Duplicate Detection Criterion Field, RANK/DESC,DATE/DESC
+ "reference" // collection display name
+ }
+ ,
+ {
+ "story", // set index name
+ "story", // set collection name
+ "0,3", // set pageinfo (start,count)
+ "1,0,0,1,0", // set query analyzer (useKMA,isCase,useOriginal,useSynonym, duplcated detection)
+ "RANK/DESC,DATE/DESC", // set sort field (field,order) multi sort '/'
+ "basic,rpfmo,100", // set sort field (field,order) multi sort '/'
+ "TITLE,SUMMARY,INTERFACE_ID,GENYEAR_SCH,TRS_AGE_EX,CHRONOLOGICAL_START_SCH,CHRONOLOGICAL_END_SCH,FIRST_TOPIC,SECOND_TOPIC,THEME_CD_EX,THEME_NM_EX,SERIES_CD_EX,SERIES_NM_EX,FIRST_CATEGORY_NM,SECOND_CATEGORY_NM,KEYWORDS_EX,TAGS",// set search field
+ "DOCID,DATE,TITLE,SUMMARY,THEME_CD,THEME_NM,SERIES_CD,SERIES_NM,SIDO_NAME,SIGUNGU_NAME,DONG_NAME1,AGE,TRS_AGE,LINK_DATA,FIRST_TOPIC,SECOND_TOPIC,TAGS,KEYWORDS,COUNCIL,READ_CNT,INTERFACE_ID,GENYEAR,CHRONOLOGICAL_START,CHRONOLOGICAL_END,ID,SEARCH_THEME_CD,SEARCH_THEME_NM,SEARCH_AREA_COUNCIL,MAIN_IMG,FIRST_CLASS,SECOND_CLASS,FIRST_CLASS_NM,SECOND_CLASS_NM,FIRST_CATEGORY,SECOND_CATEGORY,FIRST_CATEGORY_NM,SECOND_CATEGORY_NM,ALIAS,SOJANG_COUNCIL,GENYEAR_SCH,CHRONOLOGICAL_START_SCH,CHRONOLOGICAL_END_SCH",// set document field
+ "", // set date range
+ "", // set rank range
+ "", // set prefix query, example: |/1, (fieldname:contains:value) and ' ', or '|', not '!' / operator (AND:1, OR:0)
+ "", // set collection query (/option...) and ' ', or '|'
+ "", // set boost query ( | ...) and ' ', or '|'
+ "", // set filter operation ()
+ "", // set groupby field(field, count)
+ "", // set sort field group(field/order,field/order,...)
+ "", // set categoryBoost(fieldname,matchType,boostID,boostKeyword)
+ "", // set categoryGroupBy (fieldname:value)
+ "", // set categoryQuery (fieldname:value)
+ "", // set property group (fieldname,min,max, groupcount)
+ "THEME_CD,THEME_NM,TRS_AGE,SEARCH_THEME_CD,SEARCH_THEME_NM,SOJANG_COUNCIL,KEYWORDS,SERIES_CD,SERIES_NM,SECOND_CATEGORY,FIRST_CATEGORY", // use check prefix query filed
+ "READ_CNT,GENYEAR,CHRONOLOGICAL_START,CHRONOLOGICAL_END", // set use check fast access field
+ "", // set multigroupby field
+ "", // set auth query (Auth Target Field, Auth Collection, Auth Reference Field, Authority Query)
+ "", // set Duplicate Detection Criterion Field, RANK/DESC,DATE/DESC
+ "story" // collection display name
+ }
+ ,
+ {
+ "culturePost", // set index name
+ "culturePost", // set collection name
+ "0,3", // set pageinfo (start,count)
+ "1,0,0,1,0", // set query analyzer (useKMA,isCase,useOriginal,useSynonym, duplcated detection)
+ "RANK/DESC,DATE/DESC", // set sort field (field,order) multi sort '/'
+ "basic,rpfmo,100", // set sort field (field,order) multi sort '/'
+ "TITLE,SUMMARY,TAGS,KEYWORDS",// set search field
+ "DOCID,DATE,TITLE,SUMMARY,TAGS,MAIN_IMG,ALIAS,KEYWORDS",// set document field
+ "", // set date range
+ "", // set rank range
+ "", // set prefix query, example: |/1, (fieldname:contains:value) and ' ', or '|', not '!' / operator (AND:1, OR:0)
+ "", // set collection query (/option...) and ' ', or '|'
+ "", // set boost query ( | ...) and ' ', or '|'
+ "", // set filter operation ()
+ "", // set groupby field(field, count)
+ "", // set sort field group(field/order,field/order,...)
+ "", // set categoryBoost(fieldname,matchType,boostID,boostKeyword)
+ "", // set categoryGroupBy (fieldname:value)
+ "", // set categoryQuery (fieldname:value)
+ "", // set property group (fieldname,min,max, groupcount)
+ "", // use check prefix query filed
+ "", // set use check fast access field
+ "", // set multigroupby field
+ "", // set auth query (Auth Target Field, Auth Collection, Auth Reference Field, Authority Query)
+ "", // set Duplicate Detection Criterion Field, RANK/DESC,DATE/DESC
+ "culturePost" // collection display name
+ }
+ ,
+ {
+ "total", // set index name
+ "total", // set collection name
+ "0,3", // set pageinfo (start,count)
+ "1,0,0,1,0", // set query analyzer (useKMA,isCase,useOriginal,useSynonym, duplcated detection)
+ "RANK/DESC,DATE/DESC", // set sort field (field,order) multi sort '/'
+ "basic,rpfmo,100", // set sort field (field,order) multi sort '/'
+ "TITLE,TAGS_TITLE,SUMMARY,INTERFACE_ID,GENYEAR_SCH,TRS_AGE_EX,CHRONOLOGICAL_START_SCH,CHRONOLOGICAL_END_SCH,FIRST_CATEGORY_NM,SECOND_CATEGORY_NM,FIRST_CLASS_NM,SECOND_CLASS_NM,THEME_CD_EX,THEME_NM_EX,SERIES_CD_EX,SERIES_NM_EX,COUNCIL,KEYWORDS,CONTENT_TYPE_NAME,SIDO_NAME_EX,TAGS,NUMBER_TITLE,FIRST_TOPIC,SECOND_TOPIC",// set search field
+ "DOCID,DATE,TITLE,SUMMARY,FIRST_CLASS,SECOND_CLASS,TAGS,READ_CNT,GENYEAR,TRS_AGE,CHRONOLOGICAL_START,CHRONOLOGICAL_END,FIRST_CATEGORY,SECOND_CATEGORY,THEME_CD,THEME_NM,SERIES_CD,SERIES_NM,SIDO_NAME,SOJANG_COUNCIL,LINK_DATA,MAIN_IMG,MGNT_NO,TAGS_TITLE,ALIAS,NUMBER_TITLE,SEARCH_THEME_CD,SEARCH_THEME_NM,NUMBER_SUMMARY,INTERFACE_ID,FIRST_CATEGORY_NM,SECOND_CATEGORY_NM,FIRST_CLASS_NM,SECOND_CLASS_NM,COUNCIL,KEYWORDS,CONTENT_TYPE_NAME,GENYEAR_SCH,CHRONOLOGICAL_START_SCH,CHRONOLOGICAL_END_SCH,FIRST_TOPIC,SECOND_TOPIC,ID,MEDIA_ID,ORG_OPEN_AT,ASSET_TYPE,ASSETS_ID,STRE_FILE_NAME,CONTENT_ID,CONT_TYPE",// set document field
+ "", // set date range
+ "", // set rank range
+ "", // set prefix query, example: |/1, (fieldname:contains:value) and ' ', or '|', not '!' / operator (AND:1, OR:0)
+ "", // set collection query (/option...) and ' ', or '|'
+ "", // set boost query ( | ...) and ' ', or '|'
+ "", // set filter operation ()
+ "", // set groupby field(field, count)
+ "", // set sort field group(field/order,field/order,...)
+ "", // set categoryBoost(fieldname,matchType,boostID,boostKeyword)
+ "", // set categoryGroupBy (fieldname:value)
+ "", // set categoryQuery (fieldname:value)
+ "", // set property group (fieldname,min,max, groupcount)
+ "TRS_AGE,FIRST_CATEGORY,SECOND_CATEGORY,FIRST_CLASS,SECOND_CLASS,SOJANG_COUNCIL,MGNT_NO,SIDO_NAME,THEME_CD,THEME_NM,SERIES_CD,SERIES_NM,SEARCH_THEME_NM,SEARCH_THEME_CD", // use check prefix query filed
+ "READ_CNT,GENYEAR,CHRONOLOGICAL_START,CHRONOLOGICAL_END", // set use check fast access field
+ "", // set multigroupby field
+ "", // set auth query (Auth Target Field, Auth Collection, Auth Reference Field, Authority Query)
+ "", // set Duplicate Detection Criterion Field, RANK/DESC,DATE/DESC
+ "total" // collection display name
+ }
+ ,
+ {
+ "culturePostHot", // set index name
+ "culturePostHot", // set collection name
+ "0,3", // set pageinfo (start,count)
+ "1,0,0,1,0", // set query analyzer (useKMA,isCase,useOriginal,useSynonym, duplcated detection)
+ "RANK/DESC,DATE/DESC", // set sort field (field,order) multi sort '/'
+ "basic,rpfmo,100", // set sort field (field,order) multi sort '/'
+ "TITLE,SUMMARY,INTERFACE_ID,GENYEAR_SCH,TRS_AGE_EX,CHRONOLOGICAL_START_SCH,CHRONOLOGICAL_END_SCH,FIRST_TOPIC,SECOND_TOPIC",// set search field
+ "DOCID,DATE,TITLE,SUMMARY,LINK_DATA,TAGS,MAIN_IMG,READ_CNT,INTERFACE_ID,GENYEAR,TRS_AGE,CHRONOLOGICAL_START,CHRONOLOGICAL_END,FIRST_TOPIC,SECOND_TOPIC,ID,KEYWORDS,THEME_CD,THEME_NM,SERIES_CD,SERIES_NM,ALIAS,GENYEAR_SCH,CHRONOLOGICAL_START_SCH,CHRONOLOGICAL_END_SCH",// set document field
+ "", // set date range
+ "", // set rank range
+ "", // set prefix query, example: |/1, (fieldname:contains:value) and ' ', or '|', not '!' / operator (AND:1, OR:0)
+ "", // set collection query (/option...) and ' ', or '|'
+ "", // set boost query ( | ...) and ' ', or '|'
+ "", // set filter operation ()
+ "", // set groupby field(field, count)
+ "", // set sort field group(field/order,field/order,...)
+ "", // set categoryBoost(fieldname,matchType,boostID,boostKeyword)
+ "", // set categoryGroupBy (fieldname:value)
+ "", // set categoryQuery (fieldname:value)
+ "", // set property group (fieldname,min,max, groupcount)
+ "TRS_AGE,KEYWORDS", // use check prefix query filed
+ "READ_CNT,GENYEAR,CHRONOLOGICAL_START,CHRONOLOGICAL_END", // set use check fast access field
+ "", // set multigroupby field
+ "", // set auth query (Auth Target Field, Auth Collection, Auth Reference Field, Authority Query)
+ "", // set Duplicate Detection Criterion Field, RANK/DESC,DATE/DESC
+ "culturePostHot" // collection display name
+ }
+ ,
+ {
+ "toon", // set index name
+ "toon", // set collection name
+ "0,3", // set pageinfo (start,count)
+ "1,0,0,1,0", // set query analyzer (useKMA,isCase,useOriginal,useSynonym, duplcated detection)
+ "RANK/DESC,DATE/DESC", // set sort field (field,order) multi sort '/'
+ "basic,rpfmo,100", // set sort field (field,order) multi sort '/'
+ "TITLE,SUMMARY,INTERFACE_ID,GENYEAR_SCH,CHRONOLOGICAL_START_SCH,CHRONOLOGICAL_END_SCH,FIRST_CATEGORY_NM,SECOND_CATEGORY_NM,FIRST_CLASS_NM,SECOND_CLASS_NM,TAGS",// set search field
+ "DOCID,DATE,TITLE,SUMMARY,FIRST_CLASS,SECOND_CLASS,SOJANG_COUNCIL,TAGS,KEYWORDS,READ_CNT,INTERFACE_ID,GENYEAR,TRS_AGE,CHRONOLOGICAL_START,CHRONOLOGICAL_END,FIRST_CATEGORY,SECOND_CATEGORY,SEARCH_CLASS,AUTHOR,PUBLISHER,FIRST_CATEGORY_NM,SECOND_CATEGORY_NM,SOJANG_COUNCIL_NM,SIDO_NAME,SIGUNGU_NAME,TRS_SIDO_NAME,TRS_SIGUNGU_NAME,FIRST_CLASS_NM,SECOND_CLASS_NM,SEARCH_AREA_COUNCIL,LINK_DATA,ASSETS_ID,MEDIA_ID,MAIN_IMG,MGNT_NO,ASSET_TYPE,THEME,SERIES,ORG_OPEN_AT,STRE_FILE_NAME,SUBTITLE,ADDITION,ORIGNL_FILE_NAME,FILE_SIZE,WIDTH,HEIGHT,IMG_ALT,MEDIA_TYPE,PLAYER_AT,PLAY_TIME,VOLUME,TOTAL_PAGE,ISBN,WEBSITE_NAME,LINK_USE_AT,MAKING_DATE,FILMING_LOCATION,SUBTITLE_AT,SUBTITLE_ORG_FILE_NAME,SUBTITLE_STRE_FILE_NAME,SUBTITLE_DESC,PROVIDER,SOURCE_AT,SOURCE,COPYRIGHT,RETENTION_PERIOD,COPYRIGHT_MGNT_DEPART,THIRD_COPYRIGHT,CCL_TYPE,UPDATED_AT,DELETED_AT,USE_AT,REMARKS_DESC,RECOMMEND_YN,GENYEAR_SCH,CHRONOLOGICAL_START_SCH,CHRONOLOGICAL_END_SCH",// set document field
+ "", // set date range
+ "", // set rank range
+ "", // set prefix query, example: |/1, (fieldname:contains:value) and ' ', or '|', not '!' / operator (AND:1, OR:0)
+ "", // set collection query (/option...) and ' ', or '|'
+ "", // set boost query ( | ...) and ' ', or '|'
+ "", // set filter operation ()
+ "", // set groupby field(field, count)
+ "", // set sort field group(field/order,field/order,...)
+ "", // set categoryBoost(fieldname,matchType,boostID,boostKeyword)
+ "", // set categoryGroupBy (fieldname:value)
+ "", // set categoryQuery (fieldname:value)
+ "", // set property group (fieldname,min,max, groupcount)
+ "TRS_AGE,KEYWORDS", // use check prefix query filed
+ "READ_CNT,GENYEAR,CHRONOLOGICAL_START,CHRONOLOGICAL_END", // set use check fast access field
+ "", // set multigroupby field
+ "", // set auth query (Auth Target Field, Auth Collection, Auth Reference Field, Authority Query)
+ "", // set Duplicate Detection Criterion Field, RANK/DESC,DATE/DESC
+ "toon" // collection display name
+ }
+ ,
+ {
+ "ocr", // set index name
+ "ocr", // set collection name
+ "0,3", // set pageinfo (start,count)
+ "1,0,0,1,0", // set query analyzer (useKMA,isCase,useOriginal,useSynonym, duplcated detection)
+ "RANK/DESC,DATE/DESC", // set sort field (field,order) multi sort '/'
+ "basic,rpfmo,100", // set sort field (field,order) multi sort '/'
+ "OCR_TEXT",// set search field
+ "DOCID,ID,MEDIA_ID,FIRST_PAGE_NUM,LAST_PAGE_NUM,ORDER_NUM,OCR_TEXT,FILE_NAME,ALIAS",// set document field
+ "", // set date range
+ "", // set rank range
+ "", // set prefix query, example: |/1, (fieldname:contains:value) and ' ', or '|', not '!' / operator (AND:1, OR:0)
+ "", // set collection query (/option...) and ' ', or '|'
+ "", // set boost query ( | ...) and ' ', or '|'
+ "", // set filter operation ()
+ "", // set groupby field(field, count)
+ "", // set sort field group(field/order,field/order,...)
+ "", // set categoryBoost(fieldname,matchType,boostID,boostKeyword)
+ "", // set categoryGroupBy (fieldname:value)
+ "", // set categoryQuery (fieldname:value)
+ "", // set property group (fieldname,min,max, groupcount)
+ "MEDIA_ID", // use check prefix query filed
+ "ID", // set use check fast access field
+ "", // set multigroupby field
+ "", // set auth query (Auth Target Field, Auth Collection, Auth Reference Field, Authority Query)
+ "", // set Duplicate Detection Criterion Field, RANK/DESC,DATE/DESC
+ "ocr" // collection display name
+ }
+
+ };
+ }
+ }
diff --git a/src/main/java/kccf/sch/common/WNCommon.java b/src/main/java/kccf/sch/common/WNCommon.java
new file mode 100644
index 00000000..f99657fa
--- /dev/null
+++ b/src/main/java/kccf/sch/common/WNCommon.java
@@ -0,0 +1,1583 @@
+package kccf.sch.common;
+
+
+import java.io.IOException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import QueryAPI530.Search;
+import static kccf.sch.common.WNUtils.*;
+
+public class WNCommon {
+ private static final Logger LOGGER = LoggerFactory.getLogger(WNCommon.class);
+ private Search search = null;
+ boolean isDebug = false;
+
+ /**
+ * SF-1 Search 클래스 객체를 생성하는 WNCommon의 생성자 함수이다.
+ */
+ public WNCommon() {
+ this.search = new Search();
+ }
+
+ /**
+ * 검색 질의 키워드와 질의나 출력에 사용될 문자집합을 정한다. v4.x 호환 method이므로
+ * COMMON_OR_WHEN_NORESULT을 지정하지 않는다.
+ *
+ * @param query
+ * @param charSet
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ * @deprecated As of v4.x, replaced by
+ * {@link #setCommonQuery(String,String,int)}
+ */
+ public int setCommonQuery(String query, String charSet) {
+ int ret = 0;
+ ret = search.w3SetCodePage(charSet);
+ ret = search.w3SetQueryLog(1);
+ ret = search.w3SetTraceLog(0);
+ ret = search.w3SetCommonQuery(query, 0);
+ return ret;
+ }
+
+ /**
+ * 검색 질의 UID와 질의나 출력에 사용될 문자집합을 정한다.
+ *
+ * @param charSet
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setUidQuery(String charSet) {
+ int ret = 0;
+ ret = search.w3SetCodePage(charSet);
+ ret = search.w3SetQueryLog(0);
+ return ret;
+ }
+
+ /**
+ * 검색 질의 키워드와 질의나 출력에 사용될 문자집합을 정한다.
+ *
+ * @param query
+ * @param charSet
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setCommonQuery(String query, String charSet, int useOrResult,
+ boolean useSuggestedQuery) {
+ int ret = 0;
+ ret = search.w3SetCodePage(charSet);
+ ret = search.w3SetQueryLog(1);
+ ret = search.w3SetTraceLog(0);
+ ret = search.w3SetCommonQuery(query, useOrResult);
+ if (useSuggestedQuery) {
+ ret = search.w3SetSpellCorrectionQuery(query, 0);
+ }
+ return ret;
+ }
+
+ /**
+ * setCommonQuery의 오버로딩(overloading) 함수로 session정보를 부가기능으로 사용할 수 있다. v4.x 호환
+ * method이므로 COMMON_OR_WHEN_NORESULT을 지정하지 않는다.
+ *
+ * @param query
+ * @param charSet
+ * @param logInfo
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ * @deprecated As of v4.x, replaced by
+ * {@link #setCommonQuery(String,String,String[],int)}
+ */
+ public int setCommonQuery(String query, String charSet, String[] logInfo) {
+ int ret = 0;
+ if (logInfo != null && logInfo.length > 2) {
+ ret = search.w3SetSessionInfo(logInfo[0], logInfo[1], logInfo[2]);
+ }
+ setCommonQuery(query, charSet);
+ return ret;
+ }
+
+ /**
+ * setCommonQuery의 오버로딩(overloading) 함수로 session정보를 부가기능으로 사용할 수 있다.
+ *
+ * @param query
+ * @param charSet
+ * @param logInfo
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setCommonQuery(String query, String charSet, int useOrResult,
+ String[] logInfo) {
+ int ret = 0;
+ if (logInfo != null && logInfo.length > 2) {
+ ret = search.w3SetSessionInfo(logInfo[0], logInfo[1], logInfo[2]);
+ }
+ ret = search.w3SetCodePage(charSet);
+ ret = search.w3SetQueryLog(1);
+ ret = search.w3SetCommonQuery(query, useOrResult);
+ return ret;
+ }
+
+ /**
+ * setCommonQuery의 오버로딩(overloading) 함수로 session정보를 부가기능으로 사용할 수 있다.
+ *
+ * @param query
+ * @param charSet
+ * @param logInfo
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setCommonQuery(String query, String charSet, int useOrResult,
+ boolean useSuggestedQuery, String[] logInfo) {
+ int ret = 0;
+ if (logInfo != null && logInfo.length > 2) {
+ ret = search.w3SetSessionInfo(logInfo[0], logInfo[1], logInfo[2]);
+ }
+ ret = search.w3SetCodePage(charSet);
+ ret = search.w3SetQueryLog(1);
+ ret = search.w3SetCommonQuery(query, useOrResult);
+ if (useSuggestedQuery) {
+ ret = search.w3SetSpellCorrectionQuery(query, 0);
+ }
+ return ret;
+ }
+
+ /**
+ * 컬렉션 별로 검색어 지정
+ *
+ * @param collectionName
+ * @param query
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setCollectionQuery(String collectionName, String query) {
+ return search.w3SetCollectionQuery(collectionName, query);
+ }
+
+ /**
+ * 컬렉션 별로 boost query 지정
+ *
+ * @param collectionName
+ * @param boost
+ * query
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setBoostQuery(String collectionName, String query) {
+ int idx = query.lastIndexOf("/");
+ int option = Integer.parseInt(query.substring(idx, query.length()));
+ return search.w3SetBoostQuery(collectionName, query, option);
+ }
+
+ /**
+ * 컬렉션 별로 boost query 지정
+ *
+ * @param collectionName
+ * @param boost
+ * query
+ * @param option
+ * 0,1,2
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setBoostQuery(String collectionName, String query, int option) {
+ return search.w3SetBoostQuery(collectionName, query, option);
+ }
+
+ /**
+ * 검색하고자 하는 컬렉션의 UID를 설정한다.
+ *
+ * @param collectionName
+ * @param values
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setUid(String collectionName, String[] values, String searcherId) {
+ int ret = 0;
+ for (int i = 0; i < values.length; i++) {
+ long uid = 0L;
+ try {
+ uid = Long.parseLong(values[i]);
+ } catch (NumberFormatException e) {
+ return -1;
+ }
+ ret = search.w3AddUid(collectionName, uid, searcherId);
+ }
+ return ret;
+ }
+
+ /**
+ * 검색대상 컬렉션, 언어분석기 사용유무, 대소문자 구분유무를 설정한다. v4.x 호환 method이므로 USEORIGINAL,
+ * USESYNONYM을 지정하지 않는다.
+ *
+ * @param collectionName
+ * @param useKma
+ * @param isCase
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ * @deprecated As of v4.5, replaced by
+ * {@link #addCollection(String,int,int,int,int,int)}
+ */
+ public int addCollection(String collectionName, int useKma, int isCase) {
+ int ret = 0;
+ ret = search.w3AddCollection(collectionName);
+ // USEMA, ISCASE, USEORIGINAL, USESYNONYM
+ ret = search.w3SetQueryAnalyzer(collectionName, useKma, isCase, 1, 1);
+ ret = search.w3SetDuplicateDetection(collectionName);
+ // systemOut("[w3AddCollection] "+collectionName);
+ return ret;
+ }
+
+ /**
+ * 검색대상 컬렉션, 언어분석기 사용유무, 대소문자 구분유무를 설정한다.
+ *
+ * @param collectionName
+ * @param useKma
+ * @param isCase
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int addCollection(String collectionName, int useKma, int isCase,
+ int useOriginal, int useSynonym, int duplicateDectection) {
+ int ret = 0;
+ ret = search.w3AddCollection(collectionName);
+ // USEMA, ISCASE, USEORIGINAL, USESYNONYM
+ ret = search.w3SetQueryAnalyzer(collectionName, useKma, isCase,
+ useOriginal, useSynonym);
+ // systemOut("[w3AddCollection] "+collectionName);
+ if (duplicateDectection == 1) {
+ ret = search.w3SetDuplicateDetection(collectionName);
+ }
+ return ret;
+ }
+
+ /**
+ * 추상 컬렉션 추가 v4.x 호환 method이므로 USEORIGINAL, USESYNONYM을 지정하지 않는다.
+ *
+ * @param aliasName
+ * 설정한 별칭 컬렉션명
+ * @param collectionName
+ * 실제 컬렉션
+ * @param useKma
+ * @param isCase
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ * @deprecated As of v4.5, replaced by
+ * {@link #addAliasCollection(String,String,int,int,int,int,int)}
+ */
+ public int addAliasCollection(String aliasName, String collectionName,
+ int useKma, int isCase) {
+ int ret = 0;
+ ret = search.w3AddAliasCollection(aliasName, collectionName);
+ ret = search.w3SetQueryAnalyzer(aliasName, useKma, isCase, 1, 1);
+ ret = search.w3SetDuplicateDetection(aliasName);
+ return ret;
+ }
+
+ /**
+ * 추상 컬렉션 추가
+ *
+ * @param aliasName
+ * 설정한 별칭 컬렉션명
+ * @param collectionName
+ * 실제 컬렉션
+ * @param useKma
+ * @param isCase
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int addAliasCollection(String aliasName, String collectionName,
+ int useKma, int isCase, int useOriginal, int useSynonym,
+ int duplicateDectection) {
+ int ret = 0;
+ ret = search.w3AddAliasCollection(aliasName, collectionName);
+ ret = search.w3SetQueryAnalyzer(aliasName, useKma, isCase, useOriginal,
+ useSynonym);
+ if (duplicateDectection == 1) {
+ ret = search.w3SetDuplicateDetection(aliasName);
+ }
+ return ret;
+ }
+
+ /**
+ * 검색기 연결
+ *
+ * @param ip
+ * @param port
+ * @param timeOut
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int getConnection(String ip, int port, int timeOut) {
+ int ret = search.w3ConnectServer(ip, port, timeOut);
+ return ret;
+ }
+
+ /**
+ * 해당 컬렉션의 검색 대상 필드를 여러 개를 설정한다. v4.x 호환 method이므로 fieldscore를 지정하지 않는다.
+ *
+ * @param collectionName
+ * @param fields
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ * @deprecated As of v4.5, replaced by
+ * {@link #setSearchField(String,String)}
+ **/
+ public int addSearchField(String collectionName, String[] fields) {
+ int ret = 0;
+ for (int i = 0; i < fields.length; i++) {
+ ret = search.w3AddSearchField(collectionName, fields[i]);
+ systemOut("[w3AddSearchField] " + collectionName + " / "
+ + fields[i]);
+ }
+ return ret;
+ }
+
+ /**
+ * 검색 필드별 랭킹 스코어(score)를 설정한다.
+ *
+ * @param collectionName
+ * @param fields
+ * TITLE,CONTENT
+ * @param rankScores
+ * 100,30
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int addSearchFieldScore(String collectionName, String[] fields,
+ int[] rankScores) {
+ int ret = 0;
+ for (int i = 0; i < fields.length; i++) {
+ ret = search.w3AddSearchFieldScore(collectionName, fields[i],
+ rankScores[i]);
+ systemOut("[w3AddSearchFieldScore] " + collectionName + " / "
+ + fields[i] + "/" + rankScores[i]);
+ }
+ return ret;
+ }
+
+ /**
+ * 해당 컬렉션의 검색 대상 필드를 여러 개를 설정한다.
+ *
+ * @param collectionName
+ * @param fields
+ * TITLE/100,CONTENT/30
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setSearchField(String collectionName, String fields) {
+ int ret = 0;
+ String[] searchFieldTemp = split(fields, ","); // TITLE/100,CONTENT/30
+ for (int i = 0; i < searchFieldTemp.length; i++) {
+ String[] searchField = split(searchFieldTemp[i], "/");
+ if (searchField != null && searchField.length > 0) {
+ ret = search.w3AddSearchField(collectionName, searchField[0]);
+ systemOut("[w3AddSearchField] " + collectionName + " / "
+ + searchField[0]);
+ }
+ }
+ ret = search.w3SetSearchFieldScore(collectionName, fields);
+ systemOut("[w3AddSearchField] " + collectionName + " / " + fields);
+ return ret;
+ }
+
+ /**
+ * 검색결과의 정렬필드를 설정한다. v4.x 호환 method
+ *
+ * @param collectionName
+ * @param sortField
+ * @param sortOrder
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ * @deprecated As of v4.5, replaced by {@link #setSortField(String,String)}
+ */
+ public int addSortField(String collectionName, String sortField,
+ int sortOrder) {
+ int ret = 0;
+ ret = search.w3AddSortField(collectionName, sortField, sortOrder);
+ systemOut("[w3AddSortField] " + collectionName + " / " + sortField);
+ return ret;
+ }
+
+ /**
+ * 검색결과의 정렬필드를 설정한다.
+ *
+ * @param collectionName
+ * @param sortValue
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setSortField(String collectionName, String sortValue) {
+ int ret = 0;
+ ret = search.w3SetSortField(collectionName, sortValue);
+ systemOut("[w3SetSortField] " + collectionName + " / " + sortValue);
+ return ret;
+ }
+
+ /**
+ * 검색결과 RANKING을 설정한다. SF-1 v5.0 신규 추가 method.
+ *
+ * @param collectionName
+ * @param method
+ * 랭킹 메소드( basic, custom, BM25 )
+ * @param option
+ * - p( proximity ) - r( field weight ) - k( multi keyword factor
+ * ) - f( frequency ) - m( morpheme ) - o( offset ) - l( length )
+ * @param maxcount
+ * Ranking 표기의 MAX 값. (예) %로 표기할 시 100
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setRanking(String collectionName, String method, String option,
+ int maxcount) {
+ return search.w3SetRanking(collectionName, method, option, maxcount);
+ }
+
+ /**
+ * 검색한 결과 랭크값에 대한 범위를 지정
+ *
+ * @param collectionName
+ * Collection 이름
+ * @param minRank
+ * 최소 랭킹 값
+ * @param maxRank
+ * 최대 랭킹 값
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setRankRange(String collectionName, int minRank, int maxRank) {
+ return search.w3SetRankRange(collectionName, minRank, maxRank);
+
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @param fieldNameValues
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setPrefixQuery(String collectionName, String fieldNameValues) {
+ // value값에 /가 있을 수 있으므로 >/로 찾아서 query와 연산자를 분리한다.
+ fieldNameValues = fieldNameValues.trim();
+ int index = fieldNameValues.lastIndexOf("/");
+ String prefixQuery = "";
+ int operator = 1;
+ if (index != -1) {
+ prefixQuery = fieldNameValues.substring(0, index);
+ String temp = fieldNameValues.substring(index + 1,
+ fieldNameValues.length());
+ temp = temp.trim();
+ operator = Integer.parseInt(temp);
+ } else {
+ prefixQuery = fieldNameValues.trim();
+ }
+ int ret = search
+ .w3SetPrefixQuery(collectionName, prefixQuery, operator);
+ systemOut("[w3SetPrefixQuery]" + fieldNameValues);
+ return ret;
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @param fieldNameValues
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setFilterOperation(String collectionName, String fieldNameValues) {
+ int ret = search.w3SetFilterQuery(collectionName, fieldNameValues);
+ systemOut("[w3SetFilterQuery]" + fieldNameValues);
+ return ret;
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @param fieldNameValues
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setFilterQuery(String collectionName, String fieldNameValues) {
+ int ret = search.w3SetFilterQuery(collectionName, fieldNameValues);
+ systemOut("[w3SetFilterQuery]" + fieldNameValues);
+ return ret;
+ }
+
+ /**
+ * setResultField에서 지정한 결과 필드들의 값을 얻는 함수이다. v4.x 호환 method이다. displaylength를
+ * 지정하지 않으므로 주의해야한다.
+ *
+ * @param collectionName
+ * @param fields
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ * @deprecated As of v4.5, replaced by
+ * {@link #setResultField(String,String)}
+ */
+ public int setResultField(String collectionName, String[] fields) {
+ int ret = 0;
+ for (int i = 0; i < fields.length; i++) {
+ ret = search.w3AddDocumentField(collectionName, fields[i], 0);
+ systemOut("[w3AddDocumentField] " + collectionName + " / "
+ + fields[i]);
+ }
+ return ret;
+ }
+
+ /**
+ * setResultField에서 지정한 결과 필드들의 값을 얻는 함수이다.
+ *
+ * @param collectionName
+ * @param fields
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setResultField(String collectionName, String fields) {
+ int ret = 0;
+ ret = search.w3SetDocumentField(collectionName, fields);
+ systemOut("[w3SetDocumentField] " + collectionName + " / " + fields);
+ return ret;
+ }
+
+ /**
+ * 해당 컬렉션의 몇 번째 검색 결과부터 몇 개를 가져올 것인지를 지정하고 하이라이트 기능과 요약기능을 지정하는 함수이다. 검색 API
+ * v3.5에서는 w3SetHighlight의 파라미터가 2개이지만 v3.7에서는 3개이다.
+ *
+ * @param collName
+ * @param highlight
+ * @param startPos
+ * @param resultCnt
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setPageInfo(String collName, int highlight, int startPos,
+ int resultCnt) {
+ int ret = 0;
+ if (highlight == 1) { // OFF, ON
+ ret = search.w3SetHighlight(collName, 0, 1);
+ } else if (highlight == 2) { // ON , OFF
+ ret = search.w3SetHighlight(collName, 1, 0);
+ } else if (highlight == 3) { // ON, ON
+ ret = search.w3SetHighlight(collName, 1, 1);
+ } else {// OFF, OFF
+ ret = search.w3SetHighlight(collName, 0, 0);
+ }
+ // 페이지, 기본정렬 설정
+ ret = search.w3SetPageInfo(collName, startPos, resultCnt);
+
+ return ret;
+ }
+
+ /**
+ * 검색한 결과 날짜/시간 범위를 지정하고 시작날짜와 종료날짜의 형식이 YYYY/MM/DD가 아니라면 변경할 문자를 인자로 지정한다.
+ *
+ * @param collectionName
+ * @param startDate
+ * @param endDate
+ * @param replaceChr
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setDateRange(String collectionName, String startDate,
+ String endDate, String replaceChr) {
+ // 날짜 조건 세팅
+ int ret = 0;
+ if (!startDate.equals("") && !endDate.equals("")) {
+ startDate = replace(startDate, replaceChr, "/");
+ endDate = replace(endDate, replaceChr, "/");
+ ret = search.w3SetDateRange(collectionName, startDate, endDate);
+ }
+ return ret;
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @param field
+ * @param matchType
+ * @param boostID
+ * @param boostKeyword
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ * @deprecated As of v4.x, replaced by
+ * {@link #setBoostCategory(String,String,String,String)}
+ */
+ public int setCategoryBoost(String collectionName, String field,
+ String matchType, String boostID, String boostKeyword) {
+ int ret = 0;
+ ret = search.w3SetBoostCategory(collectionName, field, matchType,
+ boostKeyword);
+ return ret;
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @param field
+ * @param matchType
+ * @param boostID
+ * @param boostKeyword
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setBoostCategory(String collectionName, String field,
+ String matchType, String boostID, String boostKeyword) {
+ return search.w3SetBoostCategory(collectionName, field, matchType,
+ boostKeyword);
+ }
+
+ /**
+ * 검색결과에서 중복문서 정렬 기준을 설정한다.
+ *
+ * @param collectionName
+ * Collection 명
+ * @param categoryGroup
+ * Category 그룹정보
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int addDuplicateDetectionCriterionField(String collection,
+ String field, int nOrder) {
+ int ret = -1;
+ ret = search.w3AddDuplicateDetectionCriterionField(collection, field,
+ nOrder);
+ return ret;
+ }
+
+ /**
+ * 검색결과에서 중복문서 정렬 기준을 설정한다.
+ *
+ * @param collectionName
+ * Collection 명
+ * @param categoryGroup
+ * Category 그룹정보
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setDuplicateDetectionCriterionField(String collection,
+ String fieldList) {
+ int ret = -1;
+ ret = search.w3SetDuplicateDetectionCriterionField(collection,
+ fieldList);
+ return ret;
+ }
+
+ /**
+ * 검색결과 패킷에 카테고리 지정 컬렉션의 카테고리 필드에서 Depth별 Category의 리스트를 포함시킨다.
+ *
+ * @param collectionName
+ * Collection 명
+ * @param categoryGroup
+ * Category 그룹정보
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int addCategoryGroupBy(String collectionName, String[] categoryGroup) {
+ int ret = -1;
+ int length = categoryGroup.length;
+ for (int i = 0; i < length; i++) {
+ String[] dataFields = split(categoryGroup[i], ":");
+ if (dataFields.length == 2) {
+ // depthList depth의 list를 콤마(:) 로 구분하여 입력
+ ret = search.w3AddCategoryGroupBy(collectionName,
+ dataFields[0], dataFields[1]);
+ }
+ }
+ return ret;
+ }
+
+ /**
+ * 선택한 컬렉션 내의 선택 카테고리 필드의 값으로 검색결과를 필터링 한다. 혹은 다른 쿼리없이 본쿼리를 실행하면 해당 카테고리의 값에
+ * 매치되는 문서를 출력한다.
+ *
+ * @param collectionName
+ * Collection 명
+ * @param categoryQuery
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int addCategoryQuery(String collectionName, String[] categoryQuery) {
+ int ret = -1;
+ int length = categoryQuery.length;
+ for (int i = 0; i < length; i++) {
+ String[] dataFields = split(categoryQuery[i], ":");
+ if (dataFields.length == 2) {
+ ret = search.w3AddCategoryQuery(collectionName, dataFields[0],
+ dataFields[1]);
+ }
+ }
+ return ret;
+ }
+
+ /**
+ * w3SetCategoryGroupBy를 통해 패킷에 포함된 해당 collection-field-depth를 key로 하는 카테고리의
+ * 총 개수를 반환
+ *
+ * @param collectionName
+ * 검색 대상 collection명
+ * @param fieldName
+ * Category Field 명
+ * @param depth
+ * 현재 그룹핑하여 보고자 하는 depth
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int getCategoryCount(String collectionName, String field, int depth) {
+ return search.w3GetCategoryCount(collectionName, field, depth);
+ }
+
+ /**
+ * w3SetCategoryGroupBy를 통해 패킷에 포함된 해당 collection-field-depth를 key로 하는 카테고리
+ * 중 categoryIdx번째의 완전한 카테고리 이름을 반환
+ *
+ * @param collectionName
+ * 검색 대상 collection명
+ * @param fieldName
+ * Category Field 명
+ * @param depth
+ * 현재 그룹핑하여 보고자 하는 depth
+ * @param idx
+ * 해당 컬렉션-카테고리-Depth에 해당하는 카테고리 결과의 인덱스
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public String getCategoryName(String collectionName, String field,
+ int depth, int idx) {
+ return search.w3GetCategoryName(collectionName, field, depth, idx);
+ }
+
+ /**
+ * w3SetCategoryGroupBy를 통해 패킷에 포함된 해당 collection-field-depth를 key로 하는 카테고리
+ * 중 categoryIdx번째의 카테고리안에 몇 개의 문서가 포함되어있는지(검색 결과내에서)를 반환
+ *
+ * @param collectionName
+ * 검색 대상 collection명
+ * @param fieldName
+ * Category Field 명
+ * @param depth
+ * 현재 그룹핑하여 보고자 하는 depth
+ * @param idx
+ * 해당 컬렉션-카테고리-Depth에 해당하는 카테고리 결과의 인덱스
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int getDocumentCountInCategory(String collectionName, String field,
+ int depth, int idx) {
+ return search.w3GetDocumentCountInCategory(collectionName, field,
+ depth, idx);
+ }
+
+ /**
+ * 특정 필드의 값을 기준으로 범위 별로 그룹을 만들거나, 이 필드 값이 특정 범위에 속하는 레코드만 추출 @
+ * collectionName @ field @ min @ max @ groupCount
+ */
+ public int setPropertyGroup(String collectionName, String field, int min,
+ int max, int groupCount) {
+ int ret = 0;
+ ret = search.w3SetPropertyGroup(collectionName, field, min, max,
+ groupCount);
+ return ret;
+ }
+
+ /**
+ * v3.7에서는 2개의 전달인자 v4.0에서는 3개의 전달인자
+ *
+ * @param collectionName
+ * @param field
+ * @param docCount
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setGroupBy(String collectionName, String field, int docCount) {
+ int ret = 0;
+ ret = search.w3SetGroupBy(collectionName, field, docCount);
+ return ret;
+ }
+
+ /**
+ * 단순히 최종 결과에서 특정 필드(들)값의 그룹핑된 결과를 얻어오기 원할 때 사용
+ *
+ * @param collectionName
+ * 컬렉션명
+ * @param fieldName
+ * 그룹핑할 필드명
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int addMultiGroupBy(String collectionName, String fields) {
+ int ret = 0;
+ String[] field = split(fields, ",");
+ int length = field.length;
+ for (int i = 0; i < length; i++) {
+ ret = search.w3AddMultiGroupBy(collectionName, field[i]);
+ }
+ return ret;
+ }
+
+ public int setMultiGroupBy(String collectionName, String fields) {
+ return search.w3SetMultiGroupBy(collectionName, fields);
+ }
+
+ /**
+ * 멀티 그룹바이된 결과를 반환
+ *
+ * @param collectionName
+ * 컬렉션명
+ * @param fieldName
+ * 그룹핑할 필드명
+ * @return 성공 시 해당 컬렉션 결과에서 인자로 주어진 필드의 그룹핑 결과 문자열을 반환하며, 에러 발생시 빈 문자열을 반환
+ */
+ public String getMultiGroupByResult(String collectionName, String field) {
+ String ret = "";
+ ret = search.w3GetMultiGroupByResult(collectionName, field);
+ return ret;
+ }
+
+ /**
+ * 그룹 검색결과의 정렬필드를 설정한다.
+ *
+ * @param collectionName
+ * @param sortField
+ * @param sortOrder
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int addSortFieldInGroup(String collectionName, String sortField,
+ int sortOrder) {
+ int ret = 0;
+ ret = search
+ .w3AddSortFieldInGroup(collectionName, sortField, sortOrder);
+ systemOut("[w3AddSortFieldInGroup] " + collectionName + " / "
+ + sortField);
+ return ret;
+ }
+
+ /**
+ * 그룹내의 문서들의 정렬 정보들을 지정해 주는 함수
+ *
+ * @param collectionName
+ * @param sortValue
+ * url/DESC,RANK/DESC,DATE/ASC
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setSortFieldInGroup(String collectionName, String sortValue) {
+ int ret = 0;
+ ret = search.w3SetSortFieldInGroup(collectionName, sortValue);
+ systemOut("[w3SetSortFieldInGroup] " + collectionName + " / "
+ + sortValue);
+ return ret;
+ }
+
+ /**
+ * 권한 쿼리 (Authority Query)
+ *
+ * @param collection
+ * @param authTargetField
+ * @param authCollection
+ * @param authReferField
+ * @param authorityQuery
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int setAuthorityQuery(String collection, String authTargetField,
+ String authCollection, String authReferField, String authorityQuery) {
+ int ret = search.w3SetAuthorityQuery(collection, authTargetField,
+ authCollection, authReferField, authorityQuery);
+ systemOut("[w3SetAuthorityQuery]" + authorityQuery);
+ return ret;
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @return 검색기로부터 받아온 속성 그룹의 개수를 반환
+ */
+ public int getCountPropertyGroup(String collectionName) {
+ return search.w3GetCountPropertyGroup(collectionName);
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @return 전체 그룹 개수
+ */
+ public int getResultGroupCount(String collectionName) {
+ return search.w3GetResultGroupCount(collectionName);
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @return 전체 그룹 개수
+ */
+ public int getResultTotalGroupCount(String collectionName) {
+ return search.w3GetResultTotalGroupCount(collectionName);
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @parma groupIndex
+ * @return 그룹에 속하는 문서 중 가져온 문서 개수
+ */
+ public int getCountInGroup(String collectionName, int groupIndex) {
+ return search.w3GetCountInGroup(collectionName, groupIndex);
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @parma groupIndex
+ * @return 그룹에 속하는 전체문서 개수
+ */
+ public int getTotalCountInGroup(String collectionName, int groupIndex) {
+ return search.w3GetTotalCountInGroup(collectionName, groupIndex);
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @return 성공시 해당 속성 그룹의 최소값을 반환하며, 에러 발생시 음수를 반환
+ */
+ public int getMinValuePropertyGroup(String collectionName) {
+ return search.w3GetMinValuePropertyGroup(collectionName);
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @return 성공시 해당 속성 그룹의 최대값을 반환하며, 에러 발생시 음수를 반환
+ */
+ public int getMaxValuePropertyGroup(String collectionName) {
+ return search.w3GetMaxValuePropertyGroup(collectionName);
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @parma groupIndex
+ * @return 성공시 속성 그룹 결과의 최소값을 반환하며, 에러 발생시 음수를 반환
+ */
+ public int getMinValueInPropertyGroup(String collectionName, int groupIndex) {
+ return search.w3GetMinValueInPropertyGroup(collectionName, groupIndex);
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @parma groupIndex
+ * @return 성공시 속성 그룹 결과의 최대값을 반환하며, 에러 발생시 음수를 반환
+ */
+ public int getMaxValueInPropertyGroup(String collectionName, int groupIndex) {
+ return search.w3GetMaxValueInPropertyGroup(collectionName, groupIndex);
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @parma groupIndex
+ * @return 지정된 속성 그룹 내 문서개수를 반환
+ */
+ public int getDocumentCountInPropertyGroup(String collectionName,
+ int groupIndex) {
+ return search.w3GetDocumentCountInPropertyGroup(collectionName,
+ groupIndex);
+ }
+
+ /**
+ * 그룹화된 문서 중 지정된 순서의 그룹 내에서 주어진 collection 결과 에서 index 번째 문서의 Collection ID를
+ * 반환
+ *
+ * @param collectionName
+ * @param groupIndex
+ * @param docIndex
+ * @return 그룹에 속하는 문서중 원하는 문서의 필드값
+ */
+ public String getCollectionIdInGroup(String collectionName, int groupIndex,
+ int docIndex) {
+ return search.w3GetCollectionIdInGroup(collectionName, groupIndex,
+ docIndex);
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @param groupIndex
+ * @param docIndex
+ * @return 그룹에 속하는 문서중 원하는 문서의 필드값
+ */
+ public long getRankInGroup(String collectionName, int groupIndex,
+ int docIndex) {
+ return search.w3GetRankInGroup(collectionName, groupIndex, docIndex);
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @param groupIndex
+ * @param docIndex
+ * @return 그룹에 속하는 문서중 원하는 문서의 필드값
+ */
+ public String getFieldInGroup(String collectionName, String fieldName,
+ int groupIndex, int docIndex) {
+ return search.w3GetFieldInGroup(collectionName, fieldName, groupIndex,
+ docIndex);
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @param groupIndex
+ * @param docIndex
+ * @return 그룹에 속하는 문서중 원하는 문서의 uid값
+ */
+ public long getUidInGroup(String collectionName, int groupIndex,
+ int docIndex) {
+ return search.w3GetUidInGroup(collectionName, groupIndex, docIndex);
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @param groupIndex
+ * @param docIndex
+ * @return 그룹에 속하는 문서중 원하는 문서의 가중치 값
+ */
+ public long getWeightInGroup(String collectionName, int groupIndex,
+ int docIndex) {
+ return search.w3GetWeightInGroup(collectionName, groupIndex, docIndex);
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @param groupIndex
+ * @param docIndex
+ * @return 그룹에 속하는 문서중 원하는 문서의 날짜 정보
+ */
+ public String getDateInGroup(String collectionName, int groupIndex,
+ int docIndex) {
+ return search.w3GetDateInGroup(collectionName, groupIndex, docIndex);
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @param groupIndex
+ * @param docIndex
+ * @return 그룹에 속하는 문서중 원하는 문서의 sc 정보
+ */
+ public String getSearcherIdInGroup(String collectionName, int groupIndex,
+ int docIndex) {
+ return search.w3GetSearcherIdInGroup(collectionName, groupIndex,
+ docIndex);
+ }
+
+ /**
+ * v4.x 호환 method v5.0에서는 삭제되었다. 하이라이팅될 문자열을 보여주는 함수이다.
+ *
+ * @return 하이라이팅될 문자열 public String getHighlightKeyword() { String keyWord =
+ * this.search.w3GetHighlightKeyword().trim(); return keyWord; }
+ */
+
+ /**
+ * 형태소 분석된 결과 문자열을 보여주는 함수이다.
+ *
+ * @param colName
+ * @param field
+ * @return 하이라이팅될 문자열
+ */
+ public String getHighlightKeywordByField(String colName, String searchField) {
+ String keyWord = this.search
+ .w3GetHighlightByField(colName, searchField);
+ return keyWord;
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @return 검색결과 개수
+ */
+ public int getResultCount(String collectionName) {
+ return search.w3GetResultCount(collectionName);
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @return 검색결과 총 개수
+ */
+ public int getResultTotalCount(String collectionName) {
+ return search.w3GetResultTotalCount(collectionName);
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @param idx
+ * @return 검색한 해당 문서의 중복문서 개수를 반환
+ */
+ public int getDuplicateDocumentCount(String collectionName, int idx) {
+ return search.w3GetDuplicateDocumentCount(collectionName, idx);
+ }
+
+ /**
+ *
+ * @param collectionName
+ * @param groupIndex
+ * @param docIndex
+ * @return 그룹화된 문서 중 지정된 순서의 그룹 내에서 각 결과들이 중복된 문서의 개수를 반환
+ */
+ public int getDuplicateDocumentCountInGroup(String collectionName,
+ int groupIndex, int docIndex) {
+ return search.w3GetDuplicateDocumentCountInGroup(collectionName,
+ groupIndex, docIndex);
+ }
+
+ /**
+ * 최근에 검색된 키워드리스트를 반환한다.
+ *
+ * @param count
+ * @return 최근에 검색된 키워드리스트
+ */
+ public String[] receiveRecentQueryListResult(int mode, int count) {
+ int ret = search.w3ReceiveRecentQueryListResult(mode, count);
+ if (ret < 0) {
+ systemOut("[W3ReceiveRecentQueryListResult] "
+ + search.w3GetErrorInfo() + ", ret=" + ret);
+ return null;
+ }
+ int size = search.w3GetRecentQueryListSize();
+ String[] keyList = new String[size];
+ for (int i = 0; i < size; i++) {
+ keyList[i] = search.w3GetRecentQuery(i);
+ }
+ return keyList;
+ }
+
+ /**
+ * 최근에 검색된 키워드리스트를 반환한다.
+ *
+ * @param count
+ * @return 최근에 검색된 키워드리스트
+ */
+ public int receiveRecentQueryListResultAsXml(int mode, int count) {
+ int ret = search.w3ReceiveRecentQueryListResultAsXml(mode, count);
+ if (ret < 0) {
+ systemOut("[w3ReceiveRecentQueryListResultAsXml] "
+ + search.w3GetErrorInfo() + ", ret=" + ret);
+ return -1;
+ }
+ return ret;
+ }
+
+ /**
+ * 최근에 검색된 키워드리스트를 반환한다.
+ *
+ * @param count
+ * @return 최근에 검색된 키워드리스트
+ */
+ public int receiveRecentQueryListResultAsJson(int mode, int count) {
+ int ret = search.w3ReceiveRecentQueryListResultAsJson(mode, count);
+ if (ret < 0) {
+ systemOut("[w3ReceiveRecentQueryListResultAsJson] "
+ + search.w3GetErrorInfo() + ", ret=" + ret);
+ return -1;
+ }
+ return ret;
+ }
+
+ /**
+ */
+ public String getSuggestedQuery() {
+ return search.w3GetSuggestedQuery();
+ }
+
+ /**
+ * v4.x 호환 method
+ *
+ * @param mode
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ * @deprecated As of v4.x, replaced by
+ * {@link #receiveSearchQueryResult(int)}
+ */
+ public int recvResult(int mode) {
+ int ret = search.w3ReceiveSearchQueryResult(mode);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ public int recvDuplicateDocumentsResult(int mode) {
+ int ret = search.w3ReceiveDuplicateDocumentsResult(mode);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ public int recvDuplicateDocumentsResultAsJson(int mode) {
+ int ret = search.w3ReceiveDuplicateDocumentsResultAsJson(mode);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ public int recvDuplicateDocumentsResultAsXml(int mode) {
+ int ret = search.w3ReceiveDuplicateDocumentsResultAsXml(mode);
+ return ret;
+ }
+
+ /**
+ *
+ * @param mode
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int receiveSearchQueryResult(int mode) {
+ int ret = search.w3ReceiveSearchQueryResult(mode);
+ return ret;
+ }
+
+ /**
+ *
+ * @param mode
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int receiveSearchQueryResultAsXml(int mode) {
+ int ret = search.w3ReceiveSearchQueryResultAsXml(mode);
+ return ret;
+ }
+
+ /**
+ *
+ * @param mode
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int receiveSearchQueryResultAsJson(int mode) {
+ int ret = search.w3ReceiveSearchQueryResultAsJson(mode);
+ return ret;
+ }
+
+ /**
+ *
+ * @return 성공이면 검색결과를 XML로 반환한다.
+ */
+ public String getResultXml() {
+ String ret = search.w3GetResultXml();
+ return ret;
+ }
+
+ /**
+ *
+ * @return 성공이면 검색결과를 JSON data로 반환한다.
+ */
+ public String getResultJson() {
+ String ret = search.w3GetResultJson();
+ return ret;
+ }
+
+ /**
+ * UID 검색을 검색기에 전달하고, 결과를 받는 함수이다. v4.x 호환 method
+ *
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ * @deprecated As of v4.x, replaced by {@link #receiveUidResult(int)}
+ */
+ public int recvDocument(int mode) {
+ int ret = search.w3ReceiveUidResult(mode);
+ return ret;
+ }
+
+ /**
+ * UID 검색을 검색기에 전달하고, 결과를 받는 함수이다.
+ *
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int receiveUidResult(int mode) {
+ int ret = search.w3ReceiveUidResult(mode);
+ return ret;
+ }
+
+ /**
+ * UID 검색을 검색기에 전달하고, 결과를 받는 함수이다.
+ *
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int receiveUidResultAsXml(int mode) {
+ int ret = search.w3ReceiveUidResultAsXml(mode);
+ return ret;
+ }
+
+ /**
+ * UID 검색을 검색기에 전달하고, 결과를 받는 함수이다.
+ *
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int receiveUidResultAsJson(int mode) {
+ int ret = search.w3ReceiveUidResultAsJson(mode);
+ return ret;
+ }
+
+ /**
+ * v4.x 호환 method
+ *
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ * @deprecated As of v4.x, replaced by
+ * {@link #receiveMorphemeAnalysisResult(int)}
+ */
+ public int recvAnalyzedQuery(int mode) {
+ int ret = search.w3ReceiveMorphemeAnalysisResult(mode);
+ return ret;
+ }
+
+ /**
+ *
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int receiveMorphemeAnalysisResult(int mode) {
+ int ret = search.w3ReceiveMorphemeAnalysisResult(mode);
+ return ret;
+ }
+
+ /**
+ *
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int receiveMorphemeAnalysisResultAsXml(int mode) {
+ int ret = search.w3ReceiveMorphemeAnalysisResultAsXml(mode);
+ return ret;
+ }
+
+ /**
+ *
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int receiveMorphemeAnalysisResultAsJson(int mode) {
+ int ret = search.w3ReceiveMorphemeAnalysisResultAsJson(mode);
+ return ret;
+ }
+
+ /**
+ * 주어진 collection 결과 에서 index 번째 문서의 Collection ID를 반환한다.
+ *
+ * @param coll
+ * @param idx
+ * @return FIELD VALUE
+ */
+ public String getCollectionId(String coll, int idx) {
+ return search.w3GetCollectionId(coll, idx);
+ }
+
+ /**
+ *
+ * @param coll
+ * @param field
+ * @param idx
+ * @return FIELD VALUE
+ */
+ public String getField(String coll, String field, int idx) {
+ return search.w3GetField(coll, field, idx);
+ }
+
+ /**
+ *
+ * @param coll
+ * @param idx
+ * @return DATE
+ */
+ public String getDate(String coll, int idx) {
+ return search.w3GetDate(coll, idx);
+ }
+
+ /**
+ *
+ * @param coll
+ * @param idx
+ * @return DATE
+ */
+ public long getWeight(String coll, int idx) {
+ return search.w3GetWeight(coll, idx);
+ }
+
+ /**
+ *
+ * @param coll
+ * @param idx
+ * @return RANK
+ */
+ public long getRank(String coll, int idx) {
+ return search.w3GetRank(coll, idx);
+ }
+
+ /**
+ *
+ * @param coll
+ * @param idx
+ * @return UID
+ */
+ public long getUid(String coll, int idx) {
+ return search.w3GetUid(coll, idx);
+ }
+
+ /**
+ *
+ * @param coll
+ * @param idx
+ * @return SearcherId
+ */
+ public String getSearcherId(String coll, int idx) {
+ return search.w3GetSearcherId(coll, idx);
+ }
+
+ /*
+ * 여러 컬렉션의 검색결과를 하나의 가상 컬렉션(Merge Collection) 결과로 통합하여 가져오기 원할 때 사용하는 함수
+ *
+ * @param mergeCollection 통합 가상 컬렉션명
+ *
+ * @param collections[] (통합대상) 컬렉션명
+ *
+ * @param start (결과 중) 시작 문서 인덱스
+ *
+ * @param count (결과 중) 가져올 문서 개수
+ *
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int addMergeCollectionInfo(String mergeCollection,
+ String[] collections, int start, int count) {
+ int collectionLen = collections.length;
+ int ret = 0;
+
+ for (int i = 0; i < collectionLen; i++) {
+
+ ret = search.w3AddMergeCollection(mergeCollection, collections[i]);
+ }
+
+ ret = search.w3SetMergePageInfo(mergeCollection, start, count);
+
+ return ret;
+ }
+
+ /*
+ * 통합 컬렉션(Merge Collection)의 결과 필드(Document Field)와 통합될 개별 컬렉션의 결과 필드를 1:N (
+ * 0 < N < 64 ) 관계로 연결시킨다
+ *
+ * @param mergeCollection 통합 가상 컬렉션명
+ *
+ * @param mergeFields[] 가상 통합 컬렉션의 결과 필드명
+ *
+ * @param collections[] (통합대상) 컬렉션명
+ *
+ * @param fields[,] (통합대상) 컬렉션의 결과 필드명
+ *
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int addMergeDocumentField(String mergeCollection,
+ String[] mergeFields, String[] collections, String[][] fields) {
+ int ret = 0;
+ int collectionLen = collections.length;
+ int fieldsLen = mergeFields.length;
+
+ for (int i = 0; i < collectionLen; i++) {
+
+ for (int j = 0; j < fieldsLen; j++) {
+ ret = search.w3AddMergeDocumentField(mergeCollection,
+ mergeFields[j], collections[i], fields[i][j]);
+ }
+ }
+ return ret;
+ }
+
+ /*
+ * w3AddMergeDocumentField 함수가 통합 컬렉션의 결과 필드를 정의 하였다면, 이 함수는 통합 컬렉션의
+ * MultiGroupBy 필드명의 정의 및 개별 컬렉션의 MultiGroupBy 필드명과 연결시키는 역할
+ *
+ * @param mergeCollection 통합 가상 컬렉션명
+ *
+ * @param mergeFields[] 가상 통합 컬렉션의 결과 필드명
+ *
+ * @param collections[] (통합대상) 컬렉션명
+ *
+ * @param fields[,] (통합대상) 컬렉션의 결과 필드명
+ *
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int addMergeMultiGroupByField(String mergeCollection,
+ String[] mergeFields, String[] collections, String[][] fields) {
+ int ret = 0;
+ int collectionLen = collections.length;
+ int fieldsLen = mergeFields.length;
+ for (int i = 0; i < collectionLen; i++) {
+ for (int j = 0; j < fieldsLen; j++) {
+ ret = search.w3AddMergeMultiGroupByField(mergeCollection,
+ mergeFields[j], collections[i], fields[i][j]);
+ }
+ }
+ return ret;
+ }
+
+ /*
+ * 통합 컬렉션의 CategoryGroupBy 필드명의 정의 및 개별 컬렉션의 CategoryGroupBy 필드명과 연결시키는 역할
+ *
+ * @param mergeCollection 통합 가상 컬렉션명
+ *
+ * @param mergeFields[] 가상 통합 컬렉션의 결과 필드명
+ *
+ * @param collections[] (통합대상) 컬렉션명
+ *
+ * @param fields[,] (통합대상) 컬렉션의 결과 필드명
+ *
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int addMergeCategoryGroupByField(String mergeCollection,
+ String[] mergeFields, String[] collections, String[][] fields) {
+ int ret = 0;
+ int collectionLen = collections.length;
+ int fieldsLen = mergeFields.length;
+ for (int i = 0; i < collectionLen; i++) {
+ for (int j = 0; j < fieldsLen; j++) {
+ ret = search.w3AddMergeCategoryGroupByField(mergeCollection,
+ mergeFields[j], collections[i], fields[i][j]);
+ }
+ }
+ return ret;
+ }
+
+ /*
+ * 검색기에서 받아올 통합 컬렉션(Merge Collection) 결과의 시작 인덱스와 문서 개수를 설정 CategoryGroupBy
+ * 필드명과 연결시키는 역할
+ *
+ * @param mergeCollection 통합 가상 컬렉션명
+ *
+ * @param collections (통합대상) 컬렉션명
+ *
+ * @return 문서 개수 반환한다.
+ */
+ public int getResultTotalCountInMerge(String mergeCollection,
+ String collection) {
+ return search.w3GetResultTotalCountInMerge(mergeCollection, collection);
+ }
+
+ /**
+ * 네트워크 종료
+ */
+ public void closeServer() {
+ if (search != null) {
+ search.w3CloseServer();
+ search = null;
+ }
+ }
+
+ /**
+ * 인자로 전달받은 collection의 검색결과의 에러가 발생하면 에러 코드와 메시지를 반환한다.
+ *
+ * @param collectionName
+ * @return
+ */
+ public String getCollectionErrorInfo(String collectionName) {
+ String errorMsg = "";
+ int errorCode = search.w3GetCollectionError(collectionName);
+ if (errorCode != 0) {
+ errorMsg = search.w3GetCollectionErrorInfo(collectionName);
+ errorMsg = errorMsg + "(code:" + errorCode
+ + ")";
+ }
+ return errorMsg;
+ }
+
+ /**
+ * 검색결과의 에러가 발생하면 에러 코드와 메시지를 반환한다.
+ *
+ * @return
+ */
+ public String getErrorInfo() {
+ String errorMsg = "";
+ int errorCode = search.w3GetError();
+ if (errorCode != 0) {
+ errorMsg = search.w3GetErrorInfo();
+ errorMsg = errorMsg + "(code:" + errorCode
+ + ")";
+ }
+ return errorMsg;
+ }
+
+ /**
+ * 검색 api의 버전정보를 반환한다.
+ *
+ * @return
+ */
+ public String getVersionInfo() {
+ return search.w3GetVersionInfo();
+ }
+
+ /**
+ * 에러 코드에 대한 에러정보를 web application의 standard out log에 출력한다.
+ *
+ * @param msg
+ */
+ public void systemOut(String msg) {
+ if (isDebug) {
+ //System.out.println(msg + "
");
+ }
+ }
+
+}
diff --git a/src/main/java/kccf/sch/common/WNDefine.java b/src/main/java/kccf/sch/common/WNDefine.java
new file mode 100644
index 00000000..4099103c
--- /dev/null
+++ b/src/main/java/kccf/sch/common/WNDefine.java
@@ -0,0 +1,73 @@
+package kccf.sch.common;
+public class WNDefine {
+ public final static int CONNECTION_TIMEOUT = 20000;
+ public final static String CHARSET = "UTF-8";
+ public final static int REALTIME_COUNT=100;
+ public final static int PAGE_SCALE = 10; //view page list count
+
+ public final static int CONNECTION_KEEP = 0; //recevive mode
+ public final static int CONNECTION_REUSE = 2;
+ public final static int CONNECTION_CLOSE = 3;
+
+ public final static int ASC = 0; //order
+ public final static int DESC = 1; //order
+
+ public final static int USE_KMA_OFFOFF = 0; //synonym, morpheme
+ public final static int USE_KMA_ONON = 1;
+ public final static int USE_KMA_ONOFF = 2;
+
+ public final static int USE_RESULT_STRING = 0; //result data type
+ public final static int USE_RESULT_XML = 1;
+ public final static int USE_RESULT_JSON = 2;
+ public final static int USE_RESULT_DUPLICATE_STRING = 3; //uid result data type
+ public final static int USE_RESULT_DUPLICATE_XML = 4;
+ public final static int USE_RESULT_DUPLICATE_JSON = 5;
+
+ public final static int IS_CASE_ON = 1; //case on, off
+ public final static int IS_CASE_OFF = 0;
+
+ public final static int HI_SUM_OFFOFF = 0; //summarizing, highlighting
+ public final static int HI_SUM_OFFON = 1;
+ public final static int HI_SUM_ONOFF = 2;
+ public final static int HI_SUM_ONON = 3;
+
+ public final static int COMMON_OR_WHEN_NORESULT_OFF = 0;
+ public final static int COMMON_OR_WHEN_NORESULT_ON = 1;
+
+ public final static int INDEX_NAME = 0;
+ public final static int COLLECTION_NAME = 1;
+ public final static int PAGE_INFO = 2;
+ public final static int ANALYZER = 3;
+ public final static int SORT_FIELD = 4;
+ public final static int RANKING_OPTION = 5;
+ public final static int SEARCH_FIELD = 6;
+ public final static int RESULT_FIELD = 7;
+ public final static int DATE_RANGE = 8;
+ public final static int RANK_RANGE = 9;
+ public final static int EXQUERY_FIELD = 10;
+ public final static int COLLECTION_QUERY =11;
+ public final static int BOOST_QUERY =12;
+ public final static int FILTER_OPERATION = 13;
+ public final static int GROUP_BY = 14;
+ public final static int GROUP_SORT_FIELD = 15;
+ public final static int CATEGORY_BOOST = 16;
+ public final static int CATEGORY_GROUPBY = 17;
+ public final static int CATEGORY_QUERY = 18;
+ public final static int PROPERTY_GROUP = 19;
+ public final static int PREFIX_FIELD = 20;
+ public final static int FAST_ACCESS = 21;
+ public final static int MULTI_GROUP_BY = 22;
+ public final static int AUTH_QUERY = 23;
+ public final static int DEDUP_SORT_FIELD = 24;
+ public final static int COLLECTION_KOR = 25;
+
+ public final static int MERGE_COLLECTION_NAME = 0;
+ public final static int MERGE_MAPPING_COLLECTION_NAME = 1;
+ public final static int MERGE_PAGE_INFO = 2;
+ public final static int MERGE_RESULT_FIELD = 3;
+ public final static int MERGE_MAPPING_RESULT_FIELD = 4;
+ public final static int MERGE_MULTI_GROUP_BY_FIELD = 5;
+ public final static int MERGE_MAPPING_MULTI_GROUP_BY_FIELD = 6;
+ public final static int MERGE_CATEGORY_GROUPBY_FIELD = 7;
+ public final static int MERGE_MAPPING_CATEGORY_GROUPBY_FIELD = 8;
+}
diff --git a/src/main/java/kccf/sch/common/WNSearch.java b/src/main/java/kccf/sch/common/WNSearch.java
new file mode 100644
index 00000000..19909d69
--- /dev/null
+++ b/src/main/java/kccf/sch/common/WNSearch.java
@@ -0,0 +1,2443 @@
+package kccf.sch.common;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeSet;
+import static kccf.sch.common.WNUtils.*;
+import static kccf.sch.common.WNDefine.*;
+
+import kccf.sch.service.vo.Sf1VO;
+
+
+
+
+public class WNSearch {
+ private WNCommon common ;
+ private WNCollection wncol;
+ private String[] collection ;
+ private String[] mergeCollections ;
+ private String[] searchFields;
+ private String managerURL = "";
+ private int hiSum = 0;
+ private int connectionOpt = 0;
+ private StringBuffer sb = null;
+ private StringBuffer warningMsg = null;
+
+ private String searcherId = "";
+ private boolean isDebug = false;
+ private boolean isUidSrch = false;
+ private int resultType = 0;
+
+ public String realTimeKeywords= "";
+ public String suggestedQuery = "";
+
+ private Sf1VO sf1Vo;
+
+ public void setSf1Vo(Sf1VO sf1Vo) {
+ this.sf1Vo = sf1Vo;
+ }
+
+ /**
+ * WNCommon객체를 생성하고 검색 대상 컬렉션과 검색 대상 필드들을 설정한다.
+ * @param searcherId 검색 대상 sc id
+ * @param isDebug 검색설정을 화면에 출력할 것인지 여부를 결정
+ * @param isUidSrch 키워드 검색을 할 것인지 UID 검색을 할 것인지 여부를 결정
+ * @param collections 검색하고자 하는 컬렉션들을 Array로 지정한다.
+ * @param searchFields 검색하고자 하는 검색필드들을 Array로 지정한다.
+ */
+ public WNSearch(String searcherId, boolean isDebug, boolean isUidSrch,
+ String[] collections, String[] searchFields){
+ this.common = new WNCommon();
+ this.wncol = new WNCollection();
+ this.collection = collections;
+ this.searchFields = searchFields;
+ this.sb = new StringBuffer();
+ this.warningMsg = new StringBuffer();
+ this.isDebug = isDebug;
+ this.isUidSrch = isUidSrch;
+ this.searcherId = searcherId;
+ }
+
+ /**
+ * WNCommon객체를 생성하고 검색 대상 컬렉션과 검색 대상 필드들을 설정한다.
+ * @param searcherId 검색 대상 sc id
+ * @param isDebug 검색설정을 화면에 출력할 것인지 여부를 결정
+ * @param isUidSrch 키워드 검색을 할 것인지 UID 검색을 할 것인지 여부를 결정
+ * @param collections 검색하고자 하는 컬렉션들을 Array로 지정한다.
+ * @param searchFields 검색하고자 하는 검색필드들을 Array로 지정한다.
+ * @param resultType 검색결과를 반환받고자 하는 데이터 형태
+ */
+ public WNSearch(String searcherId, boolean isDebug, boolean isUidSrch,
+ String[] collections, String[] searchFields, int resultType){
+ this.common = new WNCommon();
+ this.wncol = new WNCollection();
+ this.collection = collections;
+ this.searchFields = searchFields;
+ this.sb = new StringBuffer();
+ this.warningMsg = new StringBuffer();
+ this.isDebug = isDebug;
+ this.isUidSrch = isUidSrch;
+ this.searcherId = searcherId;
+ this.resultType = resultType;
+ }
+
+ /**
+ * WNCommon객체를 생성하고 검색 대상 컬렉션과 검색 대상 필드들을 설정한다.
+ * @param searcherId 검색 대상 sc id
+ * @param isDebug 검색설정을 화면에 출력할 것인지 여부를 결정
+ * @param isUidSrch 키워드 검색을 할 것인지 UID 검색을 할 것인지 여부를 결정
+ * @param collections 검색하고자 하는 컬렉션들을 Array로 지정한다.
+ * @param mergeCollections 검색하고자 하는 가상통합컬렉션을 Array로 지정한다.
+ * @param searchFields 검색하고자 하는 검색필드들을 Array로 지정한다.
+ * @param resultType 검색결과를 반환받고자 하는 데이터 형태
+ */
+ public WNSearch(String searcherId, boolean isDebug, boolean isUidSrch,
+ String[] collections, String[] mergeCollections, String[] searchFields, int resultType){
+ this.common = new WNCommon();
+ this.wncol = new WNCollection();
+ this.collection = collections;
+ this.mergeCollections = mergeCollections;
+ this.searchFields = searchFields;
+ this.sb = new StringBuffer();
+ this.warningMsg = new StringBuffer();
+ this.isDebug = isDebug;
+ this.isUidSrch = isUidSrch;
+ this.searcherId = searcherId;
+ this.resultType = resultType;
+ }
+
+ /**
+ * WNCommon객체를 생성하고 검색 대상 컬렉션과 검색 대상 필드들을 설정한다.
+ * @param isDebug 검색설정을 화면에 출력할 것인지 여부를 결정
+ * @param isUidSrch 키워드 검색을 할 것인지 UID 검색을 할 것인지 여부를 결정
+ * @param collections 검색하고자 하는 컬렉션들을 Array로 지정한다.
+ * @param searchFields 검색하고자 하는 검색필드들을 Array로 지정한다.
+ * @param resultType 검색결과를 반환받고자 하는 데이터 형태
+ */
+ public WNSearch(boolean isDebug, boolean isUidSrch, String[] collections,
+ String[] searchFields, int resultType){
+ this.common = new WNCommon();
+ this.wncol = new WNCollection();
+ this.collection = collections;
+ this.searchFields = searchFields;
+ this.sb = new StringBuffer();
+ this.warningMsg = new StringBuffer();
+ this.isDebug = isDebug;
+ this.isUidSrch = isUidSrch;
+ this.resultType = resultType;
+ }
+
+ /**
+ * WNCommon객체를 생성하고 검색 대상 컬렉션과 검색 대상 필드들을 설정한다.
+ * @param isDebug 검색설정을 화면에 출력할 것인지 여부를 결정
+ * @param isUidSrch 키워드 검색을 할 것인지 UID 검색을 할 것인지 여부를 결정
+ * @param collections 검색하고자 하는 컬렉션들을 Array로 지정한다.
+ * @param mergeCollections 검색하고자 하는 가상통합컬렉션을 Array로 지정한다.
+ * @param searchFields 검색하고자 하는 검색필드들을 Array로 지정한다.
+ * @param resultType 검색결과를 반환받고자 하는 데이터 형태
+ */
+ public WNSearch(boolean isDebug, boolean isUidSrch, String[] collections,
+ String[] mergeCollections, String[] searchFields, int resultType){
+ this.common = new WNCommon();
+ this.wncol = new WNCollection();
+ this.collection = collections;
+ this.mergeCollections = mergeCollections;
+ this.searchFields = searchFields;
+ this.sb = new StringBuffer();
+ this.warningMsg = new StringBuffer();
+ this.isDebug = isDebug;
+ this.isUidSrch = isUidSrch;
+ this.resultType = resultType;
+ }
+
+
+ /**
+ * WNCommon객체를 생성하고 검색 대상 컬렉션과 검색 대상 필드들을 설정한다.
+ * @param isDebug 검색설정을 화면에 출력할 것인지 여부를 결정
+ * @param isUidSrch 키워드 검색을 할 것인지 UID 검색을 할 것인지 여부를 결정
+ * @param collections 검색하고자 하는 컬렉션들을 Array로 지정한다.
+ * @param searchFields 검색하고자 하는 검색필드들을 Array로 지정한다.
+ */
+ public WNSearch(boolean isDebug, boolean isUidSrch, String[] collections, String[] searchFields){
+ this.common = new WNCommon();
+ this.wncol = new WNCollection();
+ this.collection = collections;
+ this.searchFields = searchFields;
+ this.sb = new StringBuffer();
+ this.warningMsg = new StringBuffer();
+ this.isDebug = isDebug;
+ this.isUidSrch = isUidSrch;
+ }
+
+ /**
+ * WNCommon객체를 생성하고 검색 대상 컬렉션과 검색 대상 필드들을 설정한다.
+ * @param isDebug 검색설정을 화면에 출력할 것인지 여부를 결정
+ * @param isUidSrch 키워드 검색을 할 것인지 UID 검색을 할 것인지 여부를 결정
+ * @param collections 검색하고자 하는 컬렉션들을 Array로 지정한다.
+ * @param mergeCollections 검색하고자 하는 가상통합컬렉션을 Array로 지정한다.
+ * @param searchFields 검색하고자 하는 검색필드들을 Array로 지정한다.
+ */
+ public WNSearch(boolean isDebug, boolean isUidSrch, String[] collections,
+ String[] mergeCollections, String[] searchFields){
+ this.common = new WNCommon();
+ this.wncol = new WNCollection();
+ this.collection = collections;
+ this.mergeCollections = mergeCollections;
+ this.searchFields = searchFields;
+ this.sb = new StringBuffer();
+ this.warningMsg = new StringBuffer();
+ this.isDebug = isDebug;
+ this.isUidSrch = isUidSrch;
+ }
+
+ /**
+ * 검색 키워드를 설정한다.
+ * @param query 검색 키워드
+ * @param isRealQuery 실시간 검색어를 출력한 것인지 여부를 결정
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int search(String query, boolean isRealQuery, String SEARCH_IP, int SEARCH_PORT) {
+ return search(query, isRealQuery, null, HI_SUM_ONON, COMMON_OR_WHEN_NORESULT_OFF, CONNECTION_CLOSE, false, SEARCH_IP, SEARCH_PORT);
+ }
+
+
+ /**
+ * 검색 키워드를 설정한다.
+ * @param query 검색 키워드
+ * @param isRealQuery 실시간 검색어를 출력한 것인지 여부를 결정
+ * @param useOrResult 검색결과 없을 때 OR로 검색할지 여부를 결정
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int search(String query, boolean isRealQuery, int useOrResult, String SEARCH_IP, int SEARCH_PORT) {
+ return search(query, isRealQuery, null, HI_SUM_ONON, useOrResult, CONNECTION_CLOSE, false, SEARCH_IP, SEARCH_PORT);
+ }
+
+ /**
+ * 검색 키워드를 설정한다.
+ * @param query 검색 키워드
+ * @param isRealQuery 실시간 검색어를 출력한 것인지 여부를 결정
+ * @param connectionOpt 검색기와 연결을 유지할 것인지 끊을 것인지 여부를 결정
+ * @param useSuggestedQuery speller 결과를 사용할 것인지 여부를 결정
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int search(String query, boolean isRealQuery, int connectionOpt, boolean useSuggestedQuery, String SEARCH_IP, int SEARCH_PORT) {
+ this.connectionOpt = connectionOpt;
+ return search(query, isRealQuery, null, HI_SUM_ONON, COMMON_OR_WHEN_NORESULT_OFF, connectionOpt, useSuggestedQuery, SEARCH_IP, SEARCH_PORT);
+ }
+
+
+ /**
+ * 검색 키워드를 설정한다.
+ * @param query 검색 키워드
+ * @param isRealQuery 실시간 검색어를 출력한 것인지 여부를 결정
+ * @param useOrResult 검색결과 없을 때 OR로 검색할지 여부를 결정
+ * @param connectionOpt 검색기와 연결을 유지할 것인지 끊을 것인지 여부를 결정
+ * @param useSuggestedQuery speller 결과를 사용할 것인지 여부를 결정
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int search(String query, boolean isRealQuery, int useOrResult, int connectionOpt, boolean useSuggestedQuery, String SEARCH_IP, int SEARCH_PORT) {
+ this.connectionOpt = connectionOpt;
+ return search(query, isRealQuery, null, HI_SUM_ONON, useOrResult, connectionOpt, useSuggestedQuery, SEARCH_IP, SEARCH_PORT);
+ }
+
+ /**
+ * 검색 키워드를 설정한다.
+ * @param query 검색 키워드
+ * @param isRealQuery 실시간 검색어를 출력한 것인지 여부를 결정
+ * @param useOrResult 검색결과 없을 때 OR로 검색할지 여부를 결정
+ * @param connectionOpt 검색기와 연결을 유지할 것인지 끊을 것인지 여부를 결정
+ * @param hisum 하이라이팅과 요약을 사용할 옵션을 결정
+ * @param useSuggestedQuery speller 결과를 사용할 것인지 여부를 결정
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int search(String query, boolean isRealQuery, int useOrResult, int connectionOpt, int hiSum, boolean useSuggestedQuery, String SEARCH_IP, int SEARCH_PORT) {
+ this.connectionOpt = connectionOpt;
+ return search(query, isRealQuery, null, hiSum, useOrResult, connectionOpt, useSuggestedQuery, SEARCH_IP, SEARCH_PORT);
+ }
+
+ /**
+ * 검색 키워드를 설정한다.
+ * @param query 검색 키워드
+ * @param isRealQuery 실시간 검색어를 출력한 것인지 여부를 결정
+ * @param userInfo 사용자 정보를 QueryLog파일이 저장할 때 사용된다
+ * @param hisum 하이라이팅과 요약을 사용할 옵션을 결정
+ * @param useOrResult 검색결과 없을 때 OR로 검색할지 여부를 결정
+ * @param connectionOpt 검색기와 연결을 유지할 것인지 끊을 것인지 여부를 결정
+ * @param useSuggestedQuery speller 결과를 사용할 것인지 여부를 결정
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ private int search(String query, boolean isRealQuery, String[] userInfo, int hiSum, int useOrResult, int connectionOpt, boolean useSuggestedQuery, String SEARCH_IP, int SEARCH_PORT) {
+ this.connectionOpt = connectionOpt;
+ this.hiSum = hiSum;
+ int ret = 0;
+ if(!isUidSrch) {
+ ret = common.setCommonQuery(query, CHARSET, useOrResult, useSuggestedQuery, userInfo);
+ } else {
+ ret = common.setUidQuery(CHARSET);
+ }
+
+ if( collection != null){
+ for(int i=0; i", "");
+ content = content.replaceAll("", "");
+ }
+ return content;
+ }
+
+
+ /**
+ * 검색된 키워드의 분석 결과의 리스트를 얻어서 인자로 받은 문자열에 하이라이팅 한다.
+ * @param content 하이라이팅 하고자 하는 문자열
+ * @param startTag 하이라이팅 하고자 하는 Tag의 시작 문자
+ * @param endTag 하이라이팅 하고자 하는 Tag의 끝 문자
+ * @return 하이라이팅된 문자열을 반환한다.
+ */
+ public String getKeywordHl(String content, String startTag, String endTag) {
+ if(content != null) {
+ content = replace(content, "", startTag);
+ content = replace(content, "", endTag);
+ }
+ return content;
+ }
+
+
+ /**
+ * WNCollection에서 정의된 COLLECTIONS의 index를 얻는다.
+ * @param collName 검색하고자 하는 컬렉션의 이름
+ * @return 컬렉션 index를 반환한다.
+ */
+ public int getCollIdx(String collName) {
+ for(int i=0; i < WNCollection.COLLECTIONS.length; i++) {
+ if (WNCollection.COLLECTIONS[i].trim().equals(collName.trim())) return i;
+ }
+ return -1;
+ }
+
+ /**
+ * WNCollection에서 정의된 MERGE COLLECTIONS의 index를 얻는다.
+ * @param collName 검색하고자 하는 컬렉션의 이름
+ * @return 컬렉션 index를 반환한다.
+ */
+ public int getMergeCollIdx(String collName) {
+ for(int i=0; i < WNCollection.MERGE_COLLECTIONS.length; i++) {
+ if( WNCollection.MERGE_COLLECTIONS[i].trim().equals(collName.trim()) ) return i;
+ }
+ return -1;
+ }
+
+ /**
+ * 검색 후 해당 Collection의 Erro정보를 반환한다.
+ * @param collectionName 검색을 수행한 컬렉션 이름
+ * @return collection의 에러정보
+ */
+ public String getCollectionErrorInfo(String collectionName) {
+ return common.getCollectionErrorInfo(collectionName);
+ }
+
+ /**
+ * 검색 API의 버전정보를 반환한다.
+ * @return API 버전정보
+ */
+ public String getVersionInfo() {
+ return common.getVersionInfo();
+ }
+
+ /**
+ * 형태소 분석 및 대소문자 값을 체크한다.
+ * @param useKma 형태소 분석 값
+ * @param isCase 대소문자 구분 여부
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int checkKeywordAnalyzer(String collectionName, int useKma, int isCase, int useOriginal, int useSynonym, int useDuplicateDetection) {
+ int chk = 0;
+ if(useKma != 0 && useKma != 1 && useKma != 2) {
+ appendWarnings("[WARNING] [w3SetQueryAnalyzer] [checkKeywordAnalyzer] ["+ collectionName + "] '" + useKma + "' is not kma option");
+ return -1;
+ }
+ if(isCase != 0 && isCase != 1) {
+ appendWarnings("[WARNING] [w3SetQueryAnalyzer] [checkKeywordAnalyzer] ["+ collectionName + "] '" + isCase + "' is not case option");
+ return -1;
+ }
+ if(useOriginal != 0 && useOriginal != 1) {
+ appendWarnings("[WARNING] [w3SetQueryAnalyzer] [checkKeywordAnalyzer] ["+ collectionName + "] '" + useOriginal + "' is not use original option");
+ return -1;
+ }
+ if(useSynonym != 0 && useSynonym != 1) {
+ appendWarnings("[WARNING] [w3SetQueryAnalyzer] [checkKeywordAnalyzer] ["+ collectionName + "] '" + useSynonym + "' is not use synonym option");
+ return -1;
+ }
+ if(useDuplicateDetection !=0 && useDuplicateDetection != 1) {
+ appendWarnings("[WARNING] [w3SetQueryAnalyzer] [checkKeywordAnalyzer] ["+ collectionName + "] '" + useDuplicateDetection + "' is not use duplicate detection option");
+ return -1;
+ }
+
+ return chk;
+ }
+
+
+ /**
+ * 검색하고자 하는 컬렉션을 체크한다.
+ * @param collectionName 검색하고자 하는 컬렉션
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int checkValidCollection(String msg, String collectionName) {
+
+ int chk = getCollIdx(collectionName);
+ if(chk == -1 && mergeCollections != null) { //merge collection에서 check를 다시한다.
+ chk = getMergeCollIdx(collectionName);
+ }
+
+ if(chk == -1) {
+ appendWarnings("[WARNING] "+msg+" [" + collectionName + "] Collection name is not exist.");
+ }
+ return chk;
+ }
+
+
+ /**
+ * 필드를 체크하는 각 함수에서 사용된다.
+ * @param collectionName 검색하고자 하는 컬렉션
+ * @param field 필드 이름
+ * @param item WNCollection에 지정된 상수
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int checkValidField(String collectionName, String field, int item) {
+
+ int idx = getCollIdx(collectionName);
+ String[] fields = split(wncol.COLLECTION_INFO[idx][item], ",");
+ int chk = findArrayValue(field, fields);
+ return chk;
+ }
+
+
+ /**
+ * 필드를 체크하는 각 함수에서 사용된다.
+ * @param collectionName 검색하고자 하는 컬렉션
+ * @param field 필드 이름
+ * @param item WNCollection에 지정된 상수
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int checkValidDocumentField(String collectionName, String field, int item) {
+ int chk = -1;
+ int idx = getCollIdx(collectionName);
+ if(idx != -1){
+ String[] fields = split(wncol.COLLECTION_INFO[idx][item], ",");
+ int length = fields.length;
+
+ for(int i=0; i 0 && documentFields[0].equals(field)){
+ chk = i;
+ }
+ }
+ }else{ //merge collection도 체크한다.
+ idx = getMergeCollIdx(collectionName);
+ if(idx != -1) {
+ String[] fields = split(wncol.MERGE_COLLECTION_INFO[idx][MERGE_RESULT_FIELD], ",");
+ int length = fields.length;
+ for(int i=0; i"};
+ for(int i=0; i < replaceChar.length; i++) {
+ value = replace(value, replaceChar[i], " ");
+ }
+
+ String[] fieldName = split(value, " ");
+ for(int i=0; i < fieldName.length; i++) {
+ int index = 0;
+ if(fieldName[i].indexOf(":", 0) != -1) {
+ index = fieldName[i].indexOf(":", 0);
+ fieldName[i] = fieldName[i].trim().substring(0, index);
+ }
+ // 확장검색 필드 검사
+ if(checkValidField(collectionName, fieldName[i], PREFIX_FIELD) == -1) {
+ appendWarnings("[WARNING] " + msg + "[" + collectionName + "] " +fieldName[i]+ " is not prefix field.");
+ chk = -1;
+ }
+ }
+ return chk;
+ }
+
+ /**
+ * 검색하고자 하는 컬렉션의 쿼리 필드 값을 체크한다.
+ * @param msg 화면에 출력할 메시지
+ * @param collectionName 검색하고자 하는 컬렉션
+ * @param value 체크하고자 하는 필드
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int checkCollectionQueryFieldName(String msg, String collectionName, String value) {
+ int chk = 0;
+ String[] replaceChar = new String[]{"!", "|", "(", ")", "[", "]", "{", "}", "\"", "^", "<", ">"};
+ for(int i=0; i < replaceChar.length; i++) {
+ value = replace(value, replaceChar[i], " ");
+ }
+
+ String[] fieldName = split(value, " ");
+ for(int i=0; i < fieldName.length; i++) {
+ int index = 0;
+ if(fieldName[i].indexOf(":", 0) != -1) {
+ index = fieldName[i].indexOf(":", 0);
+ fieldName[i] = fieldName[i].trim().substring(0, index);
+ }
+ String[] fields = fieldName[i].split(",");
+ for(int j=0;j < fields.length; j++){
+ // 컬렉션 쿼리 필드 검사
+ if(checkValidField(collectionName, fields[j], PREFIX_FIELD) != -1) {
+ appendWarnings("[WARNING] " + msg + "[" + collectionName + "] " +fields[j]+ " is prefix field.");
+ chk = -1;
+ }
+ }
+ }
+ return chk;
+ }
+
+ /**
+ * 검색하고자 하는 컬렉션의 필터링 필드 값을 체크한다.
+ * @param msg 화면에 출력할 메시지
+ * @param collectionName 검색하고자 하는 컬렉션
+ * @param value 체크하고자 하는 필드
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int checkFilterFieldName(String msg, String collectionName, String value) {
+ int chk = 0;
+ String[] replaceChar = new String[]{"|", "(", ")", "[", "]", "{", "}", "\"", "^"};
+ for(int i=0; i < replaceChar.length; i++) {
+ value = replace(value, replaceChar[i], " ");
+ }
+
+ String[] fieldName = split(value, " ");
+ for(int i=0; i < fieldName.length; i++) {
+ int index = 0;
+ if(fieldName[i].indexOf("<", 0) != -1) {
+ index = fieldName[i].indexOf("<", 0);
+ fieldName[i] = fieldName[i].trim().substring(0, index);
+ // 필터링 검색 필드 검사
+ if(checkValidField(collectionName, fieldName[i], FAST_ACCESS) == -1) {
+ appendWarnings("[WARNING] " + msg + " [" + collectionName + "] " +fieldName[i]+ " is not fastaccess field.");
+ chk = -1;
+ }
+ }
+ }
+ return chk;
+ }
+
+
+ /**
+ * 검색결과의 지정 범위를 체크한다.
+ * @param collectionName 검색하고자 하는 컬렉션
+ * @param highlight 하이라이팅 옵션 값
+ * @param startPos 검색결과 시작 offset
+ * @param resultCnt 검색 결과 count
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int checkSetPageInfo(String collectionName, int highlight, int startPos, int resultCnt) {
+ int chk = 0;
+ if(highlight < 0 || highlight> 3 || startPos < 0 || resultCnt < 0) {
+ appendWarnings("[WARNING] [] [checkSetPageInfo] [" + collectionName + "] Highlight: '"
+ + highlight + "', StartPosition: '"+startPos+ "', ResultCount: '"+resultCnt+"' is invalid value");
+ return -1;
+ }
+ return chk;
+ }
+
+
+ /**
+ * 검색 정렬 필드를 체크한다.
+ * @param collectionName 검색하고자 하는 컬렉션
+ * @param sortField 정렬필드
+ * @param sortOrder 오름차순/내림차순
+ * @return 성공이면 0을 반환한다. 실패면 0이 아닌 값을 반환한다.
+ */
+ public int checkSortFieldName(String collectionName, String sortField, String sortOrder) {
+ if(sortField.toUpperCase().equals("DATE")) {
+ if(sortOrder.equals("DESC") == false && sortOrder.equals("ASC") == false) {
+ //DATE는 오름차순과 내림차순으로만 정렬 가능
+ appendWarnings("[ERROR] [w3AddSortField] [checkSortFieldName] [" + collectionName + "] Date sortOrder is '" + sortOrder + "'. Only DESC or ASC is allowed.");
+ return -1;
+ }
+ } else if(sortField.toUpperCase().equals("RANK")) {
+ if(sortOrder.equals("DESC") == false) {
+ //RANK는 내림차순(1)으로만 정렬 가능
+ appendWarnings("[ERROR] [w3AddSortField] [checkSortFieldName] [" + collectionName + "] RANK sortOrder is '" + sortOrder +"' Only DESC is allowed.");
+ return -1;
+ }
+ }else if(sortField.toUpperCase().equals("WEIGHT")) {
+ if(sortOrder.equals("DESC") == false && sortOrder.equals("ASC") == false) {
+ //WEIGHT는 오름차순(0)과 내림차순(1)으로만 정렬 가능
+ appendWarnings("[ERROR] [w3AddSortField] [checkSortFieldName] [" + collectionName + "] WEIGHT sortOrder is '" + sortOrder +"' Only DESC or ASC is allowed");
+ return -1;
+ }
+ }else {
+ // 정렬 필드 검사
+ if(checkValidDocumentField(collectionName, sortField, RESULT_FIELD) == -1) {
+ appendWarnings("[ERROR] [w3AddSortField] [checkSortFieldName] [" + collectionName + "] '" + sortField + "' is not exist.");
+ return -1;
+ }
+ if(checkValidField(collectionName, sortField, FAST_ACCESS) == -1) {
+ // fastaccess가 지정되지 않은 필드에서 속도 느릴수 있음.
+ appendWarnings("[WARNING] [w3AddSortField] [checkSortFieldName] [" + collectionName + "] " +sortField+ " is not fastaccess field.");
+ }
+ }
+ return 0;
+ }
+
+ /**
+ * 디버그 메시지를 구성한다.
+ * @param isRealQuery
+ * @param query
+ */
+ public void debugMsg(boolean isRealQuery, String query, String SEARCH_IP, int SEARCH_PORT){
+ sb.append("[CHARSET] " + CHARSET + " [QUERY] " + query);
+ sb.append("
[w3ConnectServer] [IP] " + SEARCH_IP + " [PORT] " + SEARCH_PORT + " [TIMEOUT]" + CONNECTION_TIMEOUT);
+ if(!isUidSrch) {
+ sb.append("
[w3RecvResult] Mode : " + this.connectionOpt);
+ if(isRealQuery){
+ sb.append("
[W3ReceiveRecentQueryListResult] Set Count : " + REALTIME_COUNT);
+ }
+ }
+
+ sb.append("
");
+ for(int i=0; i < collection.length; i++) {
+ int idx = getCollIdx(collection[i]);
+
+ if(idx < 0){
+ return;
+ }
+ int count = 0;
+
+ // 컬렉션 정보
+ String content = wncol.COLLECTION_INFO[idx][INDEX_NAME];
+ if(content != null && !content.equals("")){
+ sb.append("
[w3AddCollection] " + content + "");
+ }
+ if(!isUidSrch) {
+ //페이지 설정
+ content = wncol.COLLECTION_INFO[idx][PAGE_INFO];
+ if(content != null && !content.equals("")){
+ sb.append("
[w3SetPageInfo] " + content);
+ }
+
+ //분석 정보
+ content = wncol.COLLECTION_INFO[idx][ANALYZER];
+ if(content != null && !content.equals("")){
+ sb.append("
[w3SetQueryAnalyzer] " + content);
+ }
+
+ //하이라이팅 정보
+ count = this.hiSum;
+ if(count >= 0){
+ switch(count){
+ case 0:
+ content = " : Highlight off, Snippet off.";break;
+ case 1:
+ content = " : Highlight off, Snippet on.";break;
+ case 2:
+ content = " : Highlight on, Snippet off.";break;
+ case 3:
+ content = " : Highlight on, Snippet on.";break;
+ default:
+ content = " : wrong infomation";
+ }
+ sb.append("
[w3SetQueryAnalyzer] " + count + content);
+ }
+
+ //정렬 정보
+ content = wncol.COLLECTION_INFO[idx][SORT_FIELD];
+ if(content != null && !content.equals("")){
+ sb.append("
[w3AddSortField] " + content);
+ }
+
+ //검색 필드 정보
+ String search_field = wncol.COLLECTION_INFO[idx][SEARCH_FIELD];
+ String[] searchField = search_field.split(",");
+
+ content = wncol.COLLECTION_INFO[idx][SEARCH_FIELD];
+ if(content != null && !content.equals("")){
+ sb.append("
[w3AddSearchField] " );
+ for(int k = 0; k[w3SetDateRange] " + content);
+ }
+
+ //확장 검색 정보
+ content = wncol.COLLECTION_INFO[idx][EXQUERY_FIELD];
+ if(content != null && !content.equals("")){
+ sb.append("
[w3SetPrefixQuery] " + content.replaceAll("<", "<").replaceAll(">", ">"));
+ }
+
+ //카테고리 부스트 정보
+ content = wncol.COLLECTION_INFO[idx][CATEGORY_BOOST];
+ if(content != null && !content.equals("")){
+ sb.append("
[w3SetBoostCategory] " + content);
+ }
+
+ //컬렉션 쿼리 정보
+ content = wncol.COLLECTION_INFO[idx][COLLECTION_QUERY];
+ if(content != null && !content.equals("")){
+ sb.append("
[w3SetCollectionQuery] " + content.replaceAll("<", "<").replaceAll(">", ">"));
+ }
+
+ //필터 정보
+ content = wncol.COLLECTION_INFO[idx][FILTER_OPERATION];
+ if(content != null && !content.equals("")){
+ sb.append("
[w3SetFilterQuery] " + content.replaceAll("<", "<").replaceAll(">", ">"));
+ }
+
+ //그룹화 정보
+ content = wncol.COLLECTION_INFO[idx][GROUP_BY];
+ if(content != null && !content.equals("")){
+ sb.append("
[w3SetGroupBy] " + content);
+ }
+
+ //그룹 정렬 정보
+ content = wncol.COLLECTION_INFO[idx][GROUP_SORT_FIELD];
+ if(content != null && !content.equals("")){
+ sb.append("
[w3AddSortFieldInGroup] " + content);
+ }
+
+
+ if(!wncol.COLLECTION_INFO[idx][GROUP_BY].equals("")){
+ //전체 그룹 개수 정보
+ count = getResultGroupCount(collection[i]);
+ if(count > 0){
+ sb.append("
[w3GetGroupBycount] " + count);
+ }
+ }
+
+ // dedup field
+ content = wncol.COLLECTION_INFO[idx][DEDUP_SORT_FIELD];
+ if(content != null && !content.equals("")){
+ sb.append("
[w3SetDuplicateDetectionCriterionField] " + content);
+ }
+ }
+
+ //결과 필드 정보
+ content = wncol.COLLECTION_INFO[idx][RESULT_FIELD];
+ if(content != null && !content.equals("")){
+ sb.append("
[w3AddDocumentField] " + content);
+ }
+ sb.append("
");
+ }
+
+ //merge collection debug info
+ if(mergeCollections != null) {
+ for(int i=0; i < mergeCollections.length; i++) {
+ int idx = getMergeCollIdx(mergeCollections[i]);
+
+ if(idx < 0){
+ return;
+ }
+
+ //merge collection name 정보
+ String content = wncol.MERGE_COLLECTION_INFO[idx][MERGE_COLLECTION_NAME];
+ String mappingColl = wncol.MERGE_COLLECTION_INFO[idx][MERGE_MAPPING_COLLECTION_NAME];
+ if(content != null && !content.equals("") && mappingColl != null && !mappingColl.equals("")){
+ sb.append("
[w3AddMergeCollection] " + content + ", [Collection Name]" + mappingColl + "");
+ }
+
+ content = wncol.MERGE_COLLECTION_INFO[idx][MERGE_PAGE_INFO];
+ if(content != null && !content.equals("")){
+ sb.append("
[w3SetMergePageInfo] " + content);
+ }
+
+ content = wncol.MERGE_COLLECTION_INFO[idx][MERGE_RESULT_FIELD];
+ String mappingDocs = wncol.MERGE_COLLECTION_INFO[idx][MERGE_MAPPING_RESULT_FIELD];
+ if(content != null && !content.equals("") && mappingDocs != null && !mappingDocs.equals("")){
+ sb.append("
[w3AddMergeDocumentField] " + content + ", [Collection Document Fields]" + mappingDocs);
+ }
+
+ content = wncol.MERGE_COLLECTION_INFO[idx][MERGE_MULTI_GROUP_BY_FIELD];
+ String mappingMulti = wncol.MERGE_COLLECTION_INFO[idx][MERGE_MAPPING_MULTI_GROUP_BY_FIELD];
+ if(content != null && !content.equals("") && mappingMulti != null && !mappingMulti.equals("")){
+ sb.append("
[w3AddMergeMultiGroupByField] " + content + ", [Collection Multi-Groupby Fields]" + mappingMulti);
+ }
+
+ content = wncol.MERGE_COLLECTION_INFO[idx][MERGE_CATEGORY_GROUPBY_FIELD];
+ String mappingCategory = wncol.MERGE_COLLECTION_INFO[idx][MERGE_MAPPING_CATEGORY_GROUPBY_FIELD];
+ if(content != null && !content.equals("") && mappingCategory != null && !mappingCategory.equals("")){
+ sb.append("
[w3AddMergeCategoryGroupByField] " + content + ", [Collection Category Groupby Fields]" + mappingCategory);
+ }
+ }
+
+ sb.append("
");
+ }
+ }
+
+ /**
+ * 경고 메시지를 버퍼에 저장한다.
+ * @param msg 경고 메시지
+ */
+ public void appendWarnings(String msg) {
+ if(isDebug && !msg.equals("")){
+ warningMsg.append(msg + "
");
+ }
+ }
+
+
+ /**
+ * 에러 메시지를 버퍼에 저장한다.
+ * @param msg 에러 메시지
+ */
+ public void appendErrors(String msg) {
+ if(!msg.equals("")){
+ sb.append("
" + msg + "
");
+ }
+ }
+
+ /**
+ * 디버그 정보를 화면에 출력할 경우 메시지를 반환한다.
+ * @return 디버그 정보 반환
+ */
+ public String printDebug() {
+ if(!warningMsg.toString().equals("")){
+ return sb.toString() + "
" + warningMsg.toString()+ "
";
+ }
+ return sb.toString();
+ }
+
+ /**
+ * 관리도구의 경로를 지정한다.
+ * @param managerURL 관리도구 경로
+ */
+ public void setManagerMode(String managerURL){
+ if(managerURL != null && !managerURL.trim().equals("")){
+ this.managerURL = managerURL;
+ }
+ }
+
+ /*
+ * 매니저 동작 준비 테그를 생성한다.
+ * @param colName 컬렉션 명
+ * @param idx 결과 인덱스
+ * @param docid 특정 결과 DOCID
+ * @return 매니저 동작 준비 테그
+ */
+ public String getManagerOperationTag(String colName, int idx, String docid){
+ String uniid = colName + "_" + idx;
+ if (!this.managerURL.equals("")){
+ return "" + docid + " ";
+ }else{
+ return "";
+ }
+ }
+
+ /*
+ * 매니저 동작 테그를 생성한다.
+ * @param transferURL xml 파싱 파일 경로
+ * @return 매니저 동작 테그
+ */
+ public String getManagerActionTag(String transferURL, String SEARCH_IP, int SEARCH_PORT) {
+ if (!this.managerURL.equals(""))
+ return "";
+ else
+ return "";
+ }
+
+ /**
+ * 검색 결과 페이징 번호를 출력한다.
+ * @param startCount 검색 결과 시작 offset
+ * @param totalCount 검색 결과의 총 개수
+ * @param viewListCount 검색결과로 요청된 offset의 개수
+ * @param bundleCount 페이지 이동할 개수
+ * @return 페이징 문자열 반환
+ */
+ public static String getPageLinks(int startCount, int totalCount, int viewListCount, int bundleCount) {
+ StringBuffer sbRet = new StringBuffer();
+ WNAnchor wnanchor = getPageAnchor(startCount, totalCount, viewListCount, bundleCount);
+
+ sbRet.append("");
+
+ if(wnanchor.getFirstPage() != -1) {
+ sbRet.append("- 처음으로
");
+ sbRet.append("- 이전
");
+ } else {
+ //sbRet.append("- 처음으로
");
+ //sbRet.append("- 이전
");
+ }
+
+ int pageCount = wnanchor.getPageCount();
+ String pages[][] = wnanchor.getPages();
+
+ for(int i=0; i" + pages[i][0] + "");
+ } else {
+ sbRet.append("- "+pages[i][0]+"
");
+ }
+ }
+
+ if(wnanchor.getBundleNext() != -1) {
+ sbRet.append("- 다음
");
+ sbRet.append("- 맨끝으로
");
+
+ } else {
+ //sbRet.append("- 다음
");
+ //sbRet.append("- 맨끝으로
");
+ }
+ sbRet.append("
");
+
+ return sbRet.toString();
+ }
+
+ /**
+ * 페이지 Anchor를 생성한다.
+ * @param startNum 검색 결과 시작 offset
+ * @param totalcount 검색 결과의 총 개수
+ * @param resultCnt 검색결과로 요청된 offset의 개수
+ * @param anchorSacle 페이지 이동할 개수
+ * @return WNAnchor Object를 반환
+ */
+ public static WNAnchor getPageAnchor(int startNum, int totalcount, int resultCnt, int anchorSacle) {
+ WNAnchor anchor = new WNAnchor();
+
+ if(totalcount == 0) { //등록된 정보가 없으면 페이지 Anchor를 생성 하지 않는다.
+ return anchor;
+ }
+
+ int curBunbleNum = startNum / (resultCnt * anchorSacle);
+ int totalPageCnt = totalcount / resultCnt;
+ if(totalcount % resultCnt > 0) {
+ totalPageCnt++;
+ }
+
+ anchor.setTotalPgCount(totalPageCnt); // 전체 페이지 세팅
+
+ if ( startNum > 0){ // 이전 페이지
+ int beforePg = startNum - resultCnt;
+ anchor.setBefore(beforePg);
+ }
+
+ if( startNum+resultCnt < totalcount ){ // 다음페이지
+ int nextPg = startNum + resultCnt;
+ anchor.setNext(nextPg);
+ }
+
+ //번들 뒤로 이동
+ int bunbleBeforePg = (curBunbleNum-1) * resultCnt * anchorSacle; //이전 번들로 이동하는 번호
+ if(curBunbleNum > 0){
+ anchor.setBundleBefore(bunbleBeforePg);
+ }
+
+ //번들 앞으로 이동
+ int bundleNextPg = (1 + curBunbleNum) * anchorSacle * resultCnt;
+ if( totalPageCnt >= anchorSacle && (curBunbleNum+1) * anchorSacle < totalPageCnt ){
+ anchor.setBundleNext(bundleNextPg);
+ }
+
+ //맨처음..
+ if(startNum != 0 && curBunbleNum != 0){
+ anchor.setFirstPage(0);
+ }
+ //맨끝...
+ int lastPage = (resultCnt * totalPageCnt) - resultCnt ;
+ if( totalPageCnt >= anchorSacle && (curBunbleNum+1) * anchorSacle < totalPageCnt ) {
+ anchor.setLastPage(lastPage);
+ }
+
+ int pageCount = 1;
+ String[][] pages = new String[anchorSacle][2];
+ for(int i = 0; i < anchorSacle; i++) {
+ int startCnt = ((curBunbleNum * anchorSacle) + i) * resultCnt;
+ int pageNum = (curBunbleNum * anchorSacle) + i + 1;
+ if(startCnt < totalcount) {
+ if (startCnt != startNum) {
+ pages[i][0] = Integer.toString(pageNum);
+ pages[i][1] = Integer.toString(startCnt);
+ } else {
+ pages[i][0] = Integer.toString(pageNum);
+ pages[i][1] = "-1";
+ anchor.setCurPageNumber(pageNum);
+ }
+ anchor.setPageCount(pageCount);
+ pageCount++;
+ }
+ }
+ anchor.setPages(pages);
+ return anchor;
+ }
+
+
+
+ /**
+ * 검색 결과 페이징 번호를 출력한다.
+ * @param startCount 검색 결과 시작 offset
+ * @param totalCount 검색 결과의 총 개수
+ * @param viewListCount 검색결과로 요청된 offset의 개수
+ * @param bundleCount 페이지 이동할 개수
+ * @return 페이징 문자열 반환
+ */
+ /* public String getPageLinksWebAccess(String base, String url, int startCount, int totalCount, int viewListCount, int bundleCount) {
+
+ String RequestURI = base;
+ String RequestURL = url;
+
+ StringBuffer sbRet = new StringBuffer();
+ WNAnchor wnanchor = getPageAnchor(startCount, totalCount, viewListCount, bundleCount);
+ String ppreImg="";
+ String preImg="";
+ String nextImg="";
+ String nnextImg="";
+ ppreImg = "
";
+ preImg = "
";
+ nextImg = "
";
+ nnextImg = "
";
+
+ if(wnanchor.getFirstPage() != -1) {
+ sbRet.append(""+ppreImg+" ");
+ } else {
+ sbRet.append(ppreImg+" ");
+ }
+ if(wnanchor.getBundleBefore() != -1) {
+ sbRet.append(""+preImg+" ");
+ } else {
+ sbRet.append(preImg+" ");
+ }
+
+ int pageCount = wnanchor.getPageCount();
+ String pages[][] = wnanchor.getPages();
+
+ for(int i=0; i" + pages[i][0]+"");
+ } else {
+ sbRet.append(" "+pages[i][0]+" ");
+ }
+ if(pageCount > i+1) {
+ sbRet.append(" | ");// 페이지 경계 1 | 2 | 3
+ }
+ }
+ if(wnanchor.getBundleNext() != -1) {
+ sbRet.append(" "+nextImg+"");
+ } else {
+ sbRet.append(" "+nextImg+"");
+ }
+ if(wnanchor.getLastPage() != -1) {
+ sbRet.append(" "+nnextImg+"");
+ } else {
+ sbRet.append(" "+nnextImg+"");
+ }
+ return sbRet.toString();
+ }*/
+
+
+ public String getCollectionKorName(String col) {
+ String value = "";
+ for ( int idx=0;idx< WNCollection.COLLECTIONS.length; idx++){
+ String coll = wncol.COLLECTION_INFO[idx][COLLECTION_NAME].trim();
+ if ( coll.equals(col) )
+ return wncol.COLLECTION_INFO[idx][COLLECTION_KOR];
+
+ }
+
+ return value;
+ }
+
+ public String getCollectionName(String col) {
+ String value = "";
+ for ( int idx=0;idx< WNCollection.COLLECTIONS.length; idx++){
+ if ( WNCollection.COLLECTIONS[idx].equals(col) ) {
+ return WNCollection.COLLECTIONS_NAME[idx];
+ }
+ }
+
+ return value;
+ }
+
+ public List