Mercurial > hg > LGServices
diff src/main/java/de/mpiwg/web/jsp/FullTextSearchPage.java @ 48:13555aff1f88
new: multiple full text searching. topics and tasks improvement.
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Thu, 21 Jan 2016 11:56:30 +0100 |
parents | 35ed4e650a53 |
children | 7c2e1b14b77d |
line wrap: on
line diff
--- 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<String> batchSearchKeywords = splitBatchSearchTerm(); + logger.debug("batchSearchKeywords: " + batchSearchKeywords); + + String countingMessage = new String(); + + for (String aKeywordSet: batchSearchKeywords) { + + this.setSearchTerm(aKeywordSet); + List<String> 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 + "<br>"; + } + 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<String> splitBatchSearchTerm() { + List<String> rs = new ArrayList<String>(); + + String[] array = this.batchSearchTerm.split(";"); + + for(String tmp : array){ + tmp = tmp.replace(" ", ""); + if(StringUtils.isNotEmpty(tmp)){ + rs.add(tmp); + } + } + return rs; + } + private List<String> splitTerms(){ List<String> rs = new ArrayList<String>(); @@ -343,6 +411,14 @@ } + public String getBatchSearchTerm() { + return batchSearchTerm; + } + + public void setBatchSearchTerm(String batchSearchTerm) { + this.batchSearchTerm = batchSearchTerm; + } + public String getSearchTerm() { return searchTerm; }