comparison src/main/java/de/mpiwg/gazetteer/utils/FileManager.java @ 40:35ed4e650a53

bug fixed: full text search when section not found in section_index table. add paginator
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Mon, 07 Dec 2015 17:06:57 +0100
parents 37840afb7b80
children 7c2e1b14b77d
comparison
equal deleted inserted replaced
39:37840afb7b80 40:35ed4e650a53
59 PrintWriter out = new PrintWriter(absolutePath + fileName); 59 PrintWriter out = new PrintWriter(absolutePath + fileName);
60 60
61 String text = new String(); // make it from list 61 String text = new String(); // make it from list
62 text += "Address,LEVEL1,LEVEL2,Name,PERIOD,TimeSpan:begin,TimeSpan:end,Longitude,Latitude,PAGE,SECTION,CONTENT,BOOK_ID,Description\n"; 62 text += "Address,LEVEL1,LEVEL2,Name,PERIOD,TimeSpan:begin,TimeSpan:end,Longitude,Latitude,PAGE,SECTION,CONTENT,BOOK_ID,Description\n";
63 63
64 for (DBContents r : list) { 64 for (DBContents c : list) {
65 65
66 DBBook book = r.getSection().getBook(); 66 if (c.getSection() != null && !c.isRemoved()){
67 67
68 String description = book.getVolume() + "/" + book.getAuthor() + "/" + book.getEdition(); 68 DBBook book = c.getSection().getBook();
69 69
70 text += r.getCoordinatesBook().getPlace_name() + "," + 70 String description = book.getVolume() + "/" + book.getAuthor() + "/" + book.getEdition();
71 book.getLevel1() + "," + 71
72 book.getLevel2() + "," + 72 text += c.getCoordinatesBook().getPlace_name() + "," +
73 book.getName() + "," + 73 book.getLevel1() + "," +
74 book.getPeriod() + "," + 74 book.getLevel2() + "," +
75 book.getStart_year() + "," + 75 book.getName() + "," +
76 book.getEnd_year() + "," + 76 book.getPeriod() + "," +
77 r.getCoordinatesBook().getX() + "," + 77 book.getStart_year() + "," +
78 r.getCoordinatesBook().getY() + "," + 78 book.getEnd_year() + "," +
79 r.getPage() + "," + 79 c.getCoordinatesBook().getX() + "," +
80 r.getSection().getName() + "," + 80 c.getCoordinatesBook().getY() + "," +
81 r.getContent() + "," + 81 c.getPage() + "," +
82 r.getBookId() + "," + 82 c.getSection().getName() + "," +
83 description + "\n"; 83 c.getContent() + "," +
84 84 c.getBookId() + "," +
85 description + "\n";
86 }
85 } 87 }
86 88
87 text = text.substring(0, text.length()-2); // cut the last 2 chars, which are "\n" here 89 text = text.substring(0, text.length()-2); // cut the last 2 chars, which are "\n" here
88 90
89 out.println(text); 91 out.println(text);
145 + "<td class='tableTitle'>period</td>" 147 + "<td class='tableTitle'>period</td>"
146 + "<td class='tableTitle'>section name</td>" 148 + "<td class='tableTitle'>section name</td>"
147 + "<td class='tableTitle'>page</td>" 149 + "<td class='tableTitle'>page</td>"
148 + "<td class='tableTitle'>content</td>" 150 + "<td class='tableTitle'>content</td>"
149 + "<tr>"; 151 + "<tr>";
150 for (DBContents r : list) { 152 for (DBContents c : list) {
151 153
152 DBBook book = r.getSection().getBook(); 154 if ( c.getSection() != null && !c.isRemoved()){
153 155
154 text += "<tr>" + 156 DBBook book = c.getSection().getBook();
155 "<td>" + r.getInx() + "</td>" + 157
156 "<td>" + r.getBookId() + "</td>" + 158 text += "<tr>" +
157 "<td>" + book.getName() + "</td>" + 159 "<td>" + c.getInx() + "</td>" +
158 "<td>" + book.getLevel1() + "</td>" + 160 "<td>" + c.getBookId() + "</td>" +
159 "<td>" + book.getLevel2() + "</td>" + 161 "<td>" + book.getName() + "</td>" +
160 "<td>" + book.getPeriod() + "</td>" + 162 "<td>" + book.getLevel1() + "</td>" +
161 "<td>" + r.getSection().getName() + "</td>" + 163 "<td>" + book.getLevel2() + "</td>" +
162 "<td>" + r.getPage() + "</td>" + 164 "<td>" + book.getPeriod() + "</td>" +
163 "<td class='content'>" + r.getContent() + "</td>" + 165 "<td>" + c.getSection().getName() + "</td>" +
164 "</tr>"; 166 "<td>" + c.getPage() + "</td>" +
165 167 "<td class='content'>" + c.getContent() + "</td>" +
168 "</tr>";
169 }
166 } 170 }
167 171
168 text += "</table></body></html>"; 172 text += "</table></body></html>";
169 173
170 out.println(text); 174 out.println(text);