diff src/main/java/de/mpiwg/gazetteer/rest/GetFullTextSearchHtmlFile.java @ 58:b8ad346e39a0

new: modify based on doc 'Improving LGServices interface.docx': user workflow improvement, functions like adding task into a topic and search suggestions.
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Mon, 02 May 2016 12:03:30 +0200
parents 37840afb7b80
children 824b808a7481
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/gazetteer/rest/GetFullTextSearchHtmlFile.java	Wed Feb 17 14:58:19 2016 +0100
+++ b/src/main/java/de/mpiwg/gazetteer/rest/GetFullTextSearchHtmlFile.java	Mon May 02 12:03:30 2016 +0200
@@ -1,6 +1,8 @@
 package de.mpiwg.gazetteer.rest;
 
 import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -8,9 +10,14 @@
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.json.JSONObject;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.jsoup.select.Elements;
 
 import de.mpiwg.gazetteer.bo.LGFile;
 import de.mpiwg.gazetteer.bo.LGFullTextSearchFile;
+import de.mpiwg.gazetteer.db.DBContents;
 import de.mpiwg.gazetteer.utils.DataProvider;
 import de.mpiwg.gazetteer.utils.FileManager;
 import de.mpiwg.gazetteer.utils.HTTPUtils;
@@ -35,9 +42,15 @@
 			LGFullTextSearchFile file = DataProvider.getInstance().getFullTextSearchFile(fileId);
 			if(file != null){
 				
-				String text = FileManager.getFullTextSearchHtmlFileText(file);
+				String html = FileManager.getFullTextSearchHtmlFileText(file);
+				
+				// parse text so that it doesn't show the field "isRemoved", which has two values, true or false
+				html = html.replaceAll("isRemoved", "");
+				html = html.replaceAll("true", "");
+				html = html.replaceAll("false", "");	
+				
 				PrintWriter out = response.getWriter();
-				out.print(text);
+				out.print(html);
 				out.flush();
 				response.setContentType("text/plain; charset=UTF-8");
 				
@@ -53,7 +66,6 @@
 			}
 			
 			
-			
 		}else{
 			response.setContentType("application/json");
 			JSONObject json = new JSONObject();