Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
- simplified code (removed exception handling where not necessary) - added confirmation dialog for shutdown and restart
orbiter7c5c814a4771
diff --git a/htroot/DetailedSearch.java b/htroot/DetailedSearch.javaindex c490af4cd..ed91a21ba 100644--- a/htroot/DetailedSearch.java+++ b/htroot/DetailedSearch.java@@ -47,7 +47,6 @@// javac -classpath .:../classes index.java// if the shell's current path is HTROOT-import java.io.IOException;import java.io.UnsupportedEncodingException;import java.net.URLEncoder;import java.util.HashMap;@@ -266,9 +265,7 @@ public class DetailedSearch {prop.put("num-results_globalresults", results.getGlobalresults());for(int i=0;i<results.numResults();i++){plasmaSearchResults.searchResult result=results.getResult(i);- try {- prop.put("type_results_" + i + "_authorized_recommend", (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_ADD, "url", result.getUrl()) == null) ? 1 : 0);- } catch (IOException e) {}+ prop.put("type_results_" + i + "_authorized_recommend", (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_ADD, "url", result.getUrl()) == null) ? 1 : 0);prop.put("type_results_" + i + "_authorized_recommend_deletelink", "/yacysearch.html?search=" + results.getFormerSearch() + "&Enter=Search&count=" + results.getQuery().wantedResults + "&order=" + crypt.simpleEncode(results.getRanking().toExternalString()) + "&resource=local&time=3&deleteref=" + result.getUrlhash() + "&urlmaskfilter=.*");prop.put("type_results_" + i + "_authorized_recommend_recommendlink", "/yacysearch.html?search=" + results.getFormerSearch() + "&Enter=Search&count=" + results.getQuery().wantedResults + "&order=" + crypt.simpleEncode(results.getRanking().toExternalString()) + "&resource=local&time=3&recommendref=" + result.getUrlhash() + "&urlmaskfilter=.*");prop.put("type_results_" + i + "_authorized_urlhash", result.getUrlhash());diff --git a/htroot/Supporter.java b/htroot/Supporter.javaindex 2c396ecbe..ecf57ebda 100644--- a/htroot/Supporter.java+++ b/htroot/Supporter.java@@ -132,13 +132,8 @@ public class Supporter {description = row.getColString(2,"UTF-8");if ((url == null) || (title == null) || (description == null)) continue;refid = row.getColString(3, null);- voted = false;- try {- voted = (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null) ||- (yacyCore.newsPool.getSpecific(yacyNewsPool.PUBLISHED_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null);- } catch (IOException e) {- e.printStackTrace();- }+ voted = (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null) ||+ (yacyCore.newsPool.getSpecific(yacyNewsPool.PUBLISHED_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null);prop.put("supporter_results_" + i + "_authorized", (authenticated) ? 1 : 0);prop.put("supporter_results_" + i + "_authorized_recommend", (voted) ? 0 : 1);diff --git a/htroot/Surftips.java b/htroot/Surftips.javaindex f5d29bbd3..2681f43bb 100644--- a/htroot/Surftips.java+++ b/htroot/Surftips.java@@ -140,13 +140,8 @@ public class Surftips {description = row.getColString(2,"UTF-8");if ((url == null) || (title == null) || (description == null)) continue;refid = row.getColString(3, null);- voted = false;- try { // performance problem if published news is too full- voted = (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null) ||- (yacyCore.newsPool.getSpecific(yacyNewsPool.PUBLISHED_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null);- } catch (IOException e) {- e.printStackTrace();- }+ voted = (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null) ||+ (yacyCore.newsPool.getSpecific(yacyNewsPool.PUBLISHED_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null);prop.put("surftips_results_" + i + "_authorized", (authenticated) ? 1 : 0);prop.put("surftips_results_" + i + "_authorized_recommend", (voted) ? 0 : 1);diff --git a/htroot/env/templates/header.template b/htroot/env/templates/header.templateindex ac2c77664..e86589f2b 100644--- a/htroot/env/templates/header.template+++ b/htroot/env/templates/header.template@@ -47,8 +47,8 @@<h3>Peer Control</h3><ul class="menu"><li><a href="/Status.html" accesskey="t" class="MenuItemLink">Admin Console</a></li>- <li><a href="/Steering.html?restart=" class="MenuItemLink lock">Re-Start</a></li>- <li><a href="/Steering.html?shutdown=" class="MenuItemLink lock">Shutdown</a></li>+ <li><a href="/Steering.html?restart=" class="MenuItemLink lock" onclick="return confirm('Confirm Restart')">Re-Start</a></li>+ <li><a href="/Steering.html?shutdown=" class="MenuItemLink lock" onclick="return confirm('Confirm Shutdown')">Shutdown</a></li></ul></li><li class="menugroup" id="menugroupTheProjekt">diff --git a/htroot/yacysearch.java b/htroot/yacysearch.javaindex 5c427648a..f751d6fc3 100644--- a/htroot/yacysearch.java+++ b/htroot/yacysearch.java@@ -313,9 +313,7 @@ public class yacysearch {prop.put("num-results_globalresults", results.getGlobalresults());for(int i=0;i<results.numResults();i++){plasmaSearchResults.searchResult result=results.getResult(i);- try {- prop.put("type_results_" + i + "_authorized_recommend", (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_ADD, "url", result.getUrl()) == null) ? 1 : 0);- } catch (IOException e) {}+ prop.put("type_results_" + i + "_authorized_recommend", (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_ADD, "url", result.getUrl()) == null) ? 1 : 0);//prop.put("type_results_" + i + "_authorized_recommend_deletelink", "/yacysearch.html?search=" + results.getFormerSearch() + "&Enter=Search&count=" + results.getQuery().wantedResults + "&order=" + crypt.simpleEncode(results.getRanking().toExternalString()) + "&resource=local&time=3&deleteref=" + result.getUrlhash() + "&urlmaskfilter=.*");//prop.put("type_results_" + i + "_authorized_recommend_recommendlink", "/yacysearch.html?search=" + results.getFormerSearch() + "&Enter=Search&count=" + results.getQuery().wantedResults + "&order=" + crypt.simpleEncode(results.getRanking().toExternalString()) + "&resource=local&time=3&recommendref=" + result.getUrlhash() + "&urlmaskfilter=.*");prop.put("type_results_" + i + "_authorized_recommend_deletelink", "/yacysearch.html?search=" + results.getFormerSearch() + "&Enter=Search&count=" + results.getQuery().wantedResults + "&order=" + crypt.simpleEncode(results.getRanking().toExternalString()) + "&resource=local&time=3&deleteref=" + result.getUrlhash() + "&urlmaskfilter=.*");diff --git a/source/de/anomic/plasma/plasmaSwitchboardQueue.java b/source/de/anomic/plasma/plasmaSwitchboardQueue.javaindex 2e4f863da..5324f2211 100644--- a/source/de/anomic/plasma/plasmaSwitchboardQueue.java+++ b/source/de/anomic/plasma/plasmaSwitchboardQueue.java@@ -124,7 +124,7 @@ public class plasmaSwitchboardQueue {return new Entry(b);}- public synchronized Entry remove(String urlHash) throws IOException {+ public synchronized Entry remove(String urlHash) {Iterator i = sbQueueStack.stackIterator(true);kelondroRow.Entry rowentry;Entry entry;diff --git a/source/de/anomic/yacy/yacyNewsPool.java b/source/de/anomic/yacy/yacyNewsPool.javaindex 65441c634..3b222c77f 100644--- a/source/de/anomic/yacy/yacyNewsPool.java+++ b/source/de/anomic/yacy/yacyNewsPool.java@@ -403,7 +403,7 @@ public class yacyNewsPool {return false;}- public synchronized yacyNewsRecord getSpecific(int dbKey, String category, String key, String value) throws IOException {+ public synchronized yacyNewsRecord getSpecific(int dbKey, String category, String key, String value) {yacyNewsQueue queue = switchQueue(dbKey);yacyNewsRecord record;String s;@@ -418,7 +418,7 @@ public class yacyNewsPool {return null;}- public synchronized yacyNewsRecord getByOriginator(int dbKey, String category, String originatorHash) throws IOException {+ public synchronized yacyNewsRecord getByOriginator(int dbKey, String category, String originatorHash) {yacyNewsQueue queue = switchQueue(dbKey);yacyNewsRecord record;Iterator i = queue.records(true);@@ -433,7 +433,7 @@ public class yacyNewsPool {return null;}- public synchronized yacyNewsRecord getByID(int dbKey, String id) throws IOException {+ public synchronized yacyNewsRecord getByID(int dbKey, String id) {switch (dbKey) {case INCOMING_DB: return incomingNews.get(id);case PROCESSED_DB: return processedNews.get(id);diff --git a/source/de/anomic/yacy/yacyNewsQueue.java b/source/de/anomic/yacy/yacyNewsQueue.javaindex b9fabe4e6..df46afa94 100644--- a/source/de/anomic/yacy/yacyNewsQueue.java+++ b/source/de/anomic/yacy/yacyNewsQueue.java@@ -120,7 +120,7 @@ public class yacyNewsQueue {return entry;}- public synchronized yacyNewsRecord get(String id) throws IOException {+ public synchronized yacyNewsRecord get(String id) {yacyNewsRecord record;Iterator i = records(true);while (i.hasNext()) {@@ -130,7 +130,7 @@ public class yacyNewsQueue {return null;}- public synchronized yacyNewsRecord remove(String id) throws IOException {+ public synchronized yacyNewsRecord remove(String id) {yacyNewsRecord record;Iterator i = records(true);while (i.hasNext()) {