# HG changeset patch # User Zoe Hong # Date 1453373790 -3600 # Node ID 13555aff1f88e0b0337eb81702577f0f19ac2c54 # Parent ef113c53629b78db371cc7cbf86a3e3e1300d456 new: multiple full text searching. topics and tasks improvement. diff -r ef113c53629b -r 13555aff1f88 src/main/java/de/mpiwg/gazetteer/bo/LGTopic.java --- a/src/main/java/de/mpiwg/gazetteer/bo/LGTopic.java Mon Dec 28 12:54:55 2015 +0100 +++ b/src/main/java/de/mpiwg/gazetteer/bo/LGTopic.java Thu Jan 21 11:56:30 2016 +0100 @@ -57,6 +57,8 @@ @Transient private boolean transientDataLoaded = false; + @Transient + private Integer numOfSections = 0; public boolean isEmpty() { @@ -217,8 +219,6 @@ } - - public void setContributorsList(List contributorsList) { this.contributorsList = contributorsList; } @@ -228,6 +228,27 @@ this.transientDataLoaded = transientDataLoaded; } + + + public Integer getNumOfSections() { + if (numOfSections == 0){ + // TODO get number of sections in this topic from db table TopicSectionRelation with topicId=this.topicId + Long topicId = this.getId(); + + this.setNumOfSections(DataProvider.getInstance().getNumberOfSectionInTopic(topicId)); + + } + + return numOfSections; + } + + public void setNumOfSections(Integer numOfSections) { + this.numOfSections = numOfSections; + } + + + + public DuplexKey getKey(){ return new DuplexKey(this.userId, this.id); } @@ -236,6 +257,9 @@ return nameEn + "(" + nameCh + ", " + namePinyin + ")"; } + + + @Override public String toString(){ return "LGTopic[nameEn=" + nameEn + ", nameCh=" + nameCh + ", namePinyin=" + namePinyin + "]"; diff -r ef113c53629b -r 13555aff1f88 src/main/java/de/mpiwg/gazetteer/utils/DataProvider.java --- a/src/main/java/de/mpiwg/gazetteer/utils/DataProvider.java Mon Dec 28 12:54:55 2015 +0100 +++ b/src/main/java/de/mpiwg/gazetteer/utils/DataProvider.java Thu Jan 21 11:56:30 2016 +0100 @@ -332,10 +332,16 @@ public List getTopics(Long userId){ List list = new ArrayList(); for(LGTopic topic : getTopicMap().values()){ + /* if(topic.hasContributor(userId)){ list.add(topic); } + */ + + // add topic into list anyway, without checking the contributor role. + list.add(topic); } + return list; } @@ -496,6 +502,12 @@ } + public Integer getNumberOfSectionInTopic(Long topicId) { + List topicSectionRelationList = getTopicSectionRelationMap().getValuesByAKey(topicId); + + return topicSectionRelationList.size(); + } + /* --- end topic --- */ diff -r ef113c53629b -r 13555aff1f88 src/main/java/de/mpiwg/web/jsp/FullTextSearchPage.java --- a/src/main/java/de/mpiwg/web/jsp/FullTextSearchPage.java Mon Dec 28 12:54:55 2015 +0100 +++ b/src/main/java/de/mpiwg/web/jsp/FullTextSearchPage.java Thu Jan 21 11:56:30 2016 +0100 @@ -56,6 +56,8 @@ private String searchTerm = new String(); + private String batchSearchTerm = new String(); + private String dynastyFilter = new String(); private String adminTypeFilter = new String(); private String level1Filter = new String(); @@ -87,6 +89,8 @@ this.searchTerm = getParameter("searchTerm"); + this.batchSearchTerm = getParameter("batchSearchTerm"); + this.bookIdFilter = getParameter("bookIdFilter"); this.bookNameFilter = getParameter("bookNameFilter"); @@ -105,6 +109,57 @@ } + + public void searchBatch() { + + logger.debug("Batch Searching: " + this.batchSearchTerm); + + this.dynastyFilter = new String(); + this.level1Filter = new String(); + this.adminTypeFilter = new String(); + + + if(StringUtils.isNotEmpty(this.batchSearchTerm)){ + try { + + // parse different keyword set by delimiter ";" + + List batchSearchKeywords = splitBatchSearchTerm(); + logger.debug("batchSearchKeywords: " + batchSearchKeywords); + + String countingMessage = new String(); + + for (String aKeywordSet: batchSearchKeywords) { + + this.setSearchTerm(aKeywordSet); + List terms = splitTerms(); + + System.out.println("Full Text Search: " + terms.toString()); + + this.completeList = DBService.searchFullText(terms); + + if (this.completeList.size() != 0 ){ + // save none zero result + Collections.sort(this.completeList); + this.filter(); + + this.setFileName(this.getSearchTerm()); + this.save(); + + } + + countingMessage += this.completeList.size() + "\t" + terms + "
"; + } + this.setSearchMessage(countingMessage); + + } catch (Exception e) { + internalError(e); + } + } + + + } + public void search(){ logger.debug("Searching: " + this.searchTerm); @@ -182,7 +237,6 @@ } searchFile.setSearchTerms(this.searchTerm); - file = DataProvider.getInstance().saveLGFullTextSearchFile(this.getFilteredList(), userId, searchFile); addMsg("The table has been saved!"); @@ -264,6 +318,20 @@ } + private List splitBatchSearchTerm() { + List rs = new ArrayList(); + + String[] array = this.batchSearchTerm.split(";"); + + for(String tmp : array){ + tmp = tmp.replace(" ", ""); + if(StringUtils.isNotEmpty(tmp)){ + rs.add(tmp); + } + } + return rs; + } + private List splitTerms(){ List rs = new ArrayList(); @@ -343,6 +411,14 @@ } + public String getBatchSearchTerm() { + return batchSearchTerm; + } + + public void setBatchSearchTerm(String batchSearchTerm) { + this.batchSearchTerm = batchSearchTerm; + } + public String getSearchTerm() { return searchTerm; } diff -r ef113c53629b -r 13555aff1f88 src/main/java/de/mpiwg/web/jsp/JSPProxy.java --- a/src/main/java/de/mpiwg/web/jsp/JSPProxy.java Mon Dec 28 12:54:55 2015 +0100 +++ b/src/main/java/de/mpiwg/web/jsp/JSPProxy.java Thu Jan 21 11:56:30 2016 +0100 @@ -236,8 +236,12 @@ getSessionBean().getFullTextSearchPage().removeFocusedContent(true); } else if(StringUtils.equals(action, "recoverFocusedContent")){ getSessionBean().getFullTextSearchPage().removeFocusedContent(false); + + // for searching in batch keywords + } else if(StringUtils.equals(action, "searchBatch")){ + getSessionBean().getFullTextSearchPage().searchBatch(); - + //PAGINATOR } else if(StringUtils.equals(action, "firstPage")){ getSessionBean().getFullTextSearchPage().firstPage(); diff -r ef113c53629b -r 13555aff1f88 src/main/java/de/mpiwg/web/jsp/TopicListPage.java --- a/src/main/java/de/mpiwg/web/jsp/TopicListPage.java Mon Dec 28 12:54:55 2015 +0100 +++ b/src/main/java/de/mpiwg/web/jsp/TopicListPage.java Thu Jan 21 11:56:30 2016 +0100 @@ -61,8 +61,8 @@ this.completeTopicList = new ArrayList(); - if(getSessionBean().getUser() != null){ - for(LGTopic topic : DataProvider.getInstance().getTopics(getSessionBean().getUser().getId())){ + if(this.getSessionBean().getUser() != null){ + for(LGTopic topic : DataProvider.getInstance().getTopics(this.getSessionBean().getUser().getId())){ if (topic.isEmpty()) { logger.debug("topic doesn't exist anymore."); diff -r ef113c53629b -r 13555aff1f88 src/main/java/de/mpiwg/web/jsp/TopicPage.java --- a/src/main/java/de/mpiwg/web/jsp/TopicPage.java Mon Dec 28 12:54:55 2015 +0100 +++ b/src/main/java/de/mpiwg/web/jsp/TopicPage.java Thu Jan 21 11:56:30 2016 +0100 @@ -186,12 +186,13 @@ // all sections in the topic this.completeSectionList = DataProvider.getInstance().getAllSectionsInTopic(topic.getId()); + logger.info("completeSectionList.size=" + completeSectionList.size()); } catch (Exception e) { internalError(e); } - logger.info("completeSectionList.size=" + completeSectionList.size()); + } this.filter(); diff -r ef113c53629b -r 13555aff1f88 src/main/webapp/pages/branchPage.jsp --- a/src/main/webapp/pages/branchPage.jsp Mon Dec 28 12:54:55 2015 +0100 +++ b/src/main/webapp/pages/branchPage.jsp Thu Jan 21 11:56:30 2016 +0100 @@ -286,7 +286,21 @@ - +
+ + <% LGFile lastFile = sessionBean.getBranchPage().getLastFile(); + if(lastFile.getDvId() == null) {%> + + <% } else if (lastFile.getFileIdInDv() == null) { %> + + + + <% } else { %> + + + <% } %> + + @@ -317,18 +331,15 @@ Show text - - - + <% if(file.getDvId() == null) {%> - + <% } else if (file.getFileIdInDv() == null) { %> - - - + + <% } else { %> - + <% } %> diff -r ef113c53629b -r 13555aff1f88 src/main/webapp/pages/fullTextSearch.jsp --- a/src/main/webapp/pages/fullTextSearch.jsp Mon Dec 28 12:54:55 2015 +0100 +++ b/src/main/webapp/pages/fullTextSearch.jsp Thu Jan 21 11:56:30 2016 +0100 @@ -186,9 +186,33 @@ onclick="setAction('search', 'fullTextSearchForm');" src="<%=sessionBean.getApplicationBean().getSearchImage()%>"/> + + + + <% if (StringUtils.equals(sessionBean.getUserName(), "zhong") || StringUtils.equals(sessionBean.getUserName(), "silk")) { %> + + + + + + + + + + + <% } %> + diff -r ef113c53629b -r 13555aff1f88 src/main/webapp/pages/topicList.jsp --- a/src/main/webapp/pages/topicList.jsp Mon Dec 28 12:54:55 2015 +0100 +++ b/src/main/webapp/pages/topicList.jsp Thu Jan 21 11:56:30 2016 +0100 @@ -269,20 +269,25 @@ <%=topic.getFomattedLastChange() %> - - + - - Manage Topic - + <%if(topic.hasContributor(sessionBean.getUser().getId())){ %> + + Manage Topic + + <% } %> + + - + <%if(topic.hasContributor(sessionBean.getUser().getId())){ %> + + <% } %> + - <% } %> diff -r ef113c53629b -r 13555aff1f88 src/main/webapp/resources/css/style.css --- a/src/main/webapp/resources/css/style.css Mon Dec 28 12:54:55 2015 +0100 +++ b/src/main/webapp/resources/css/style.css Thu Jan 21 11:56:30 2016 +0100 @@ -291,7 +291,9 @@ background-color:yellow; } .removedContent { - opacity:0.3; + color:rgb(166, 166, 166); + /*opacity:0.3; color: transparent; - text-shadow: 0 0 3px rgba(0,0,0,0.8); + text-shadow: 0 0 3px rgba(0,0,0,1); + */ } \ No newline at end of file