Mercurial > hg > LGServices
comparison src/main/java/de/mpiwg/web/jsp/FullTextSearchPage.java @ 59:bc0219c2600b
new: minor improvements
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Mon, 09 May 2016 16:02:32 +0200 |
parents | b8ad346e39a0 |
children | 0a9937b06cc3 |
comparison
equal
deleted
inserted
replaced
58:b8ad346e39a0 | 59:bc0219c2600b |
---|---|
18 | 18 |
19 import de.mpiwg.gazetteer.bo.LGBranch; | 19 import de.mpiwg.gazetteer.bo.LGBranch; |
20 import de.mpiwg.gazetteer.bo.LGFile; | 20 import de.mpiwg.gazetteer.bo.LGFile; |
21 import de.mpiwg.gazetteer.bo.LGFullTextSearchFile; | 21 import de.mpiwg.gazetteer.bo.LGFullTextSearchFile; |
22 import de.mpiwg.gazetteer.db.DBContents; | 22 import de.mpiwg.gazetteer.db.DBContents; |
23 import de.mpiwg.gazetteer.db.DBSection; | |
23 import de.mpiwg.gazetteer.utils.DBService; | 24 import de.mpiwg.gazetteer.utils.DBService; |
24 import de.mpiwg.gazetteer.utils.DataProvider; | 25 import de.mpiwg.gazetteer.utils.DataProvider; |
25 import de.mpiwg.gazetteer.utils.FileManager; | 26 import de.mpiwg.gazetteer.utils.FileManager; |
26 import de.mpiwg.web.fullTextSearch.SortContentByAdminType; | 27 import de.mpiwg.web.fullTextSearch.SortContentByAdminType; |
27 import de.mpiwg.web.fullTextSearch.SortContentByBookId; | 28 import de.mpiwg.web.fullTextSearch.SortContentByBookId; |
574 rs.add(tmp); | 575 rs.add(tmp); |
575 } | 576 } |
576 } | 577 } |
577 return rs; | 578 return rs; |
578 } | 579 } |
579 | 580 |
581 | |
582 public List<String> suggestBookName(String term, int limit){ | |
583 List<String> list = new ArrayList<String>(); | |
584 for(DBContents content : this.completeList){ | |
585 String bookName = content.getSection().getBook().getName(); | |
586 if(!list.contains(bookName) && bookName.startsWith(term)){ | |
587 list.add(bookName); | |
588 } | |
589 if(limit == list.size()){ | |
590 break; | |
591 } | |
592 } | |
593 return list; | |
594 } | |
595 | |
580 public List<String> suggestDynasty(String term, int limit){ | 596 public List<String> suggestDynasty(String term, int limit){ |
581 List<String> list = new ArrayList<String>(); | 597 List<String> list = new ArrayList<String>(); |
582 for(DBContents content : this.completeList){ | 598 for(DBContents content : this.completeList){ |
583 String dynasty = content.getSection().getBook().getDynasty(); | 599 String dynasty = content.getSection().getBook().getDynasty(); |
584 if(!list.contains(dynasty) && dynasty.startsWith(term)){ | 600 if(!list.contains(dynasty) && dynasty.startsWith(term)){ |
603 } | 619 } |
604 } | 620 } |
605 return list; | 621 return list; |
606 } | 622 } |
607 | 623 |
624 public List<String> suggestLevel2(String term, int limit){ | |
625 List<String> list = new ArrayList<String>(); | |
626 for(DBContents content : this.completeList){ | |
627 String level2 = content.getSection().getBook().getLevel2(); | |
628 if(!list.contains(level2) && level2.startsWith(term)){ | |
629 list.add(level2); | |
630 } | |
631 if(limit == list.size()){ | |
632 break; | |
633 } | |
634 } | |
635 return list; | |
636 } | |
637 | |
608 public List<String> suggestAdminType(String term, int limit){ | 638 public List<String> suggestAdminType(String term, int limit){ |
609 List<String> list = new ArrayList<String>(); | 639 List<String> list = new ArrayList<String>(); |
610 for(DBContents content : this.completeList){ | 640 for(DBContents content : this.completeList){ |
611 String adminType = content.getSection().getBook().getAdmin_type(); | 641 String adminType = content.getSection().getBook().getAdmin_type(); |
612 if(!list.contains(adminType) && adminType.startsWith(term)){ | 642 if(!list.contains(adminType) && adminType.startsWith(term)){ |
617 } | 647 } |
618 } | 648 } |
619 return list; | 649 return list; |
620 } | 650 } |
621 | 651 |
652 public List<String> suggestPeriod(String term, int limit){ | |
653 List<String> list = new ArrayList<String>(); | |
654 for(DBContents content : this.completeList){ | |
655 String period = content.getSection().getBook().getPeriod(); | |
656 if(!list.contains(period) && period.startsWith(term)){ | |
657 list.add(period); | |
658 } | |
659 if(limit == list.size()){ | |
660 break; | |
661 } | |
662 } | |
663 return list; | |
664 } | |
665 public List<String> suggestSectionName(String term, int limit){ | |
666 List<String> list = new ArrayList<String>(); | |
667 for(DBContents content : this.completeList){ | |
668 String sectionName = content.getSection().getName(); | |
669 if(!list.contains(sectionName) && sectionName.startsWith(term)){ | |
670 list.add(sectionName); | |
671 } | |
672 if(limit == list.size()){ | |
673 break; | |
674 } | |
675 } | |
676 return list; | |
677 } | |
678 public List<String> suggestBookId(String term, int limit){ | |
679 List<String> list = new ArrayList<String>(); | |
680 for(DBContents content : this.completeList){ | |
681 String bookId = content.getSection().getBook().getId(); | |
682 if(!list.contains(bookId) && bookId.startsWith(term)){ | |
683 list.add(bookId); | |
684 } | |
685 if(limit == list.size()){ | |
686 break; | |
687 } | |
688 } | |
689 return list; | |
690 } | |
622 | 691 |
623 | 692 |
624 public List<LGFullTextSearchFile> getFileList() { | 693 public List<LGFullTextSearchFile> getFileList() { |
625 return fileList; | 694 return fileList; |
626 } | 695 } |