diff 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
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/gazetteer/utils/FileManager.java	Fri Dec 04 14:28:44 2015 +0100
+++ b/src/main/java/de/mpiwg/gazetteer/utils/FileManager.java	Mon Dec 07 17:06:57 2015 +0100
@@ -61,27 +61,29 @@
 		String text = new String();	// make it from list
 		text += "Address,LEVEL1,LEVEL2,Name,PERIOD,TimeSpan:begin,TimeSpan:end,Longitude,Latitude,PAGE,SECTION,CONTENT,BOOK_ID,Description\n";
 	
-		for (DBContents r : list) {
-			
-			DBBook book = r.getSection().getBook();
-			
-			String description = book.getVolume() + "/" + book.getAuthor() + "/" + book.getEdition();
+		for (DBContents c : list) {
 			
-			text += r.getCoordinatesBook().getPlace_name() + "," +
-					book.getLevel1() + "," +
-					book.getLevel2() + "," +
-					book.getName() + "," +
-					book.getPeriod() + "," +
-					book.getStart_year() + "," +
-					book.getEnd_year() + "," +
-					r.getCoordinatesBook().getX() + "," +
-					r.getCoordinatesBook().getY() + "," +
-					r.getPage() + "," +
-					r.getSection().getName() + "," +
-					r.getContent() + "," +
-					r.getBookId() + "," +
-				description + "\n";
-		
+			if (c.getSection() != null && !c.isRemoved()){
+				
+				DBBook book = c.getSection().getBook();
+				
+				String description = book.getVolume() + "/" + book.getAuthor() + "/" + book.getEdition();
+				
+				text += c.getCoordinatesBook().getPlace_name() + "," +
+						book.getLevel1() + "," +
+						book.getLevel2() + "," +
+						book.getName() + "," +
+						book.getPeriod() + "," +
+						book.getStart_year() + "," +
+						book.getEnd_year() + "," +
+						c.getCoordinatesBook().getX() + "," +
+						c.getCoordinatesBook().getY() + "," +
+						c.getPage() + "," +
+						c.getSection().getName() + "," +
+						c.getContent() + "," +
+						c.getBookId() + "," +
+					description + "\n";
+			}
 		}
 		
 		text = text.substring(0, text.length()-2);	// cut the last 2 chars, which are "\n" here
@@ -147,22 +149,24 @@
 						+ "<td class='tableTitle'>page</td>"
 						+ "<td class='tableTitle'>content</td>"
 		 			+ "<tr>";
-		for (DBContents r : list) {			
-			
-			DBBook book = r.getSection().getBook();
-
-			text += "<tr>" +
-						"<td>" + r.getInx() + "</td>" +
-						"<td>" + r.getBookId() + "</td>" +
-						"<td>" + book.getName() + "</td>" +
-						"<td>" + book.getLevel1() + "</td>" +
-						"<td>" + book.getLevel2() + "</td>" +
-						"<td>" + book.getPeriod() + "</td>" +
-						"<td>" + r.getSection().getName() + "</td>" +
-						"<td>" + r.getPage() + "</td>" +
-						"<td class='content'>" + r.getContent() + "</td>" +
-					"</tr>";
+		for (DBContents c : list) {			
 		
+			if ( c.getSection() != null && !c.isRemoved()){
+				
+				DBBook book = c.getSection().getBook();
+	
+				text += "<tr>" +
+							"<td>" + c.getInx() + "</td>" +
+							"<td>" + c.getBookId() + "</td>" +
+							"<td>" + book.getName() + "</td>" +
+							"<td>" + book.getLevel1() + "</td>" +
+							"<td>" + book.getLevel2() + "</td>" +
+							"<td>" + book.getPeriod() + "</td>" +
+							"<td>" + c.getSection().getName() + "</td>" +
+							"<td>" + c.getPage() + "</td>" +
+							"<td class='content'>" + c.getContent() + "</td>" +
+							"</tr>";
+			}
 		}
 		
 		text += "</table></body></html>";