Mercurial > hg > LGServices
changeset 1:1af9d7db348e
Changes in the pom configuration
author | "jurzua <jurzua@mpiwg-berlin.mpg.de>" |
---|---|
date | Tue, 05 May 2015 15:35:46 +0200 |
parents | 3e62083dbcbf |
children | 57d19e93f1c3 |
files | lib/hash-mapping-1.0.jar pom.xml src/main/java/de/mpiwg/gazetteer/db/DBBook.java src/main/java/de/mpiwg/gazetteer/utils/DBService.java src/main/java/de/mpiwg/web/jsp/SearchPage.java src/main/resources/config.properties |
diffstat | 6 files changed, 79 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/pom.xml Thu Apr 23 15:46:01 2015 +0200 +++ b/pom.xml Tue May 05 15:35:46 2015 +0200 @@ -16,6 +16,8 @@ <groupId>cl.talca</groupId> <artifactId>hashMapping</artifactId> <version>1.0</version> + <scope>system</scope> + <systemPath>${basedir}/lib/hash-mapping-1.0.jar</systemPath> </dependency> <!-- <dependency>
--- a/src/main/java/de/mpiwg/gazetteer/db/DBBook.java Thu Apr 23 15:46:01 2015 +0200 +++ b/src/main/java/de/mpiwg/gazetteer/db/DBBook.java Tue May 05 15:35:46 2015 +0200 @@ -23,7 +23,6 @@ private Integer start_year; private Integer end_year; - public DBBook(ResultSet rs) throws SQLException{ this.name = rs.getString("name"); this.id = rs.getString("id"); @@ -36,6 +35,7 @@ this.level1 = rs.getString("level1"); this.level2 = rs.getString("level2"); + this.admin_type = rs.getString("admin_type"); this.in_jibengujiku = rs.getString("in_jibengujiku");
--- a/src/main/java/de/mpiwg/gazetteer/utils/DBService.java Thu Apr 23 15:46:01 2015 +0200 +++ b/src/main/java/de/mpiwg/gazetteer/utils/DBService.java Tue May 05 15:35:46 2015 +0200 @@ -170,6 +170,62 @@ return list; } + public static List<DBBook> searchFullText(List<String> termList) throws SQLException{ + Long start = System.currentTimeMillis(); + + String condition = ""; + for(int i=0; i<termList.size() ; i++){ + String term = termList.get(i); + if(i>0){ + condition += " OR "; + } + condition += " contents.content like '%" + term + "%' "; + } + + + String sql = + "SELECT books.level1 AS level1, books.level2 AS level2, " + + "books.name AS name, books.line AS line,books.period AS period, books.dynasty AS dynasty, " + + "books.admin_type as admin_type, books.in_jibengujiku AS in_jibengujiku, " + + "books.start_year AS start_year, books.end_year AS end_year, " + + "books.id AS id, contents.line AS PAGE, contents.content AS CONTENT, " + + "books.volume AS volume, books.author AS author, books.edition AS edition " + + "FROM contents " + + "JOIN books ON contents.books_id = books.id " + + "WHERE " + condition + " " + + "ORDER BY contents.books_id, contents.line"; + + + Connection conn = null; + Statement stmt = null; + List<DBBook> resultSet = new ArrayList<DBBook>(); + try { + conn = getNewConnection(); + stmt = conn.createStatement(); + + int count = 0; + ResultSet rs = stmt.executeQuery(sql); + while (rs.next()) { + count++; + DBBook book = new DBBook(rs); + resultSet.add(book); + } + + System.out.println("************************* Count " + count + " **********************************"); + + rs.close(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + conn.close(); + } + + long end = System.currentTimeMillis(); + logger.debug("Time execution serching Books [ms]: " + (end - start)); + + return resultSet; + } + /** * This methods search from a list of terms. * Every term is considered a subsequence of whole section name.
--- a/src/main/java/de/mpiwg/web/jsp/SearchPage.java Thu Apr 23 15:46:01 2015 +0200 +++ b/src/main/java/de/mpiwg/web/jsp/SearchPage.java Tue May 05 15:35:46 2015 +0200 @@ -37,6 +37,7 @@ private static Integer SEARCH_IN_SECTION_NAME = 0; private static Integer SEARCH_IN_BOOK_NAME = 1; + private static Integer SEARCH_FULL_TEXT = 2; @@ -90,7 +91,10 @@ }else if(SEARCH_IN_BOOK_NAME.equals(this.searchIn)){ System.out.println("Search in Book Name"); this.completeSectionList = DBService.searchBook(terms, "name"); - } + }/*else if(SEARCH_FULL_TEXT.equals(this.searchIn)){ + System.out.println("Search Full Text"); + DBService.searchFullText(terms); + }*/ Collections.sort(this.completeSectionList);
--- a/src/main/resources/config.properties Thu Apr 23 15:46:01 2015 +0200 +++ b/src/main/resources/config.properties Tue May 05 15:35:46 2015 +0200 @@ -2,11 +2,20 @@ db_gazetter_password=admin db_gazetter_name=Gazetteer files_root=/gazetteer-server/data -#extraction_interface=http://141.14.239.50:1080/localmonographs -extraction_interface=http://localgazetteers-dev/extraction-interface -toc_interface=http://localgazetteers-dev/LGToc -dvn_server=http://localgazetteers-dev/dvn + +#Local #dvn_server=http://localhost/dvn -#root_server=http://localgazetteers.mpiwg-berlin.mpg.de:8080/gazetteer-server #root_server=http://localhost:8080/LGServices -root_server=http://localgazetteers-dev/LGServices + +#localgazetteers-dev +#dvn_server=http://localgazetteers-dev/dvn +#root_server=http://localgazetteers-dev/LGServices +#toc_interface=http://localgazetteers-dev/LGToc +#extraction_interface=http://localgazetteers-dev/extraction-interface + + +#localgazetteers +dvn_server=http://localgazetteers/dvn +root_server=http://localgazetteers/LGServices +toc_interface=http://localgazetteers/LGToc +extraction_interface=http://localgazetteers/extraction-interface \ No newline at end of file