Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
added new news window into the status page. At this moment it is just a test. The news inside the window are about peer arrivals and departures, remote search accesses and crawls
orbiter9935e83c8675
diff --git a/htroot/Status.html b/htroot/Status.htmlindex f9f06ba82..1db96bbc4 100644--- a/htroot/Status.html+++ b/htroot/Status.html@@ -3,7 +3,6 @@<head><title>YaCy '#[clientname]#': Console Status</title>#%env/templates/metas.template%#- <meta http-equiv="REFRESH" content="30" /></head><body style="margin:0px;">#%env/templates/header.template%#@@ -24,10 +23,13 @@<div class="welcome"><center>- <h2>Welcome to YaCy!</h2><br/>+ <h2>Welcome to YaCy!</h2><br />+ <iframe src="rssTerminal.html?set=PEERNEWS&width=468px&height=200px&maxlines=20&maxwidth=90"+ width="482" height="220" scrolling="no" name="newsframe"+ marginheight="0" marginwidth="0" frameborder="0"></iframe><br /><img src="Banner.png?textcolor=000000&bgcolor=ddeeee&bordercolor=aaaaaa" alt="banner" /></center>-+<dl><!-- urgent -->diff --git a/htroot/js/query.js b/htroot/js/query.jsnew file mode 100755index 000000000..816ef9229--- /dev/null+++ b/htroot/js/query.js@@ -0,0 +1,18 @@+var query = new Object();++function getQueryProps() {+ var text = "";+ for (property in query) {+ text += property + " = " + query[property] + ";\n";+ }+ return text;+}++function getURLparameters() {+ if (self.location.search.indexOf("=") == -1) {return;}+ var parameterArray = unescape(self.location.search).substring(1).split("&");+ for (var i=0;i<parameterArray.length;i++) {+ parameterArray[i] = parameterArray[i].split("=");+ eval("query." + parameterArray[i][0] + " = \"" + parameterArray[i][1] + "\"");+ }+}\ No newline at end of filediff --git a/htroot/rssTerminal.html b/htroot/rssTerminal.htmlindex f3b1ac225..05038a13d 100755--- a/htroot/rssTerminal.html+++ b/htroot/rssTerminal.html@@ -5,52 +5,41 @@<title>rss terminal</title><style type="text/css">-div#container {- padding:6px;- background:#fff;- border:1px solid #000;- width: 600px;- height: 360px;+div#feedbox {+ padding-left: 6px;+ padding-top: 6px;+ background: #fff;+ border:1px solid #888;margin:0 auto;text-align:left;+ font:9px 'Lucida Console', 'Courier New', monospace;}-div#container p {+div#feedbox p {margin:0px 0;}--div#scrollObject {- position: absolute;- overflow: hidden;- width: 600px;- height: 360px;-}--div#content {- position:absolute;- font:9px 'Lucida Console', 'Courier New', monospace;- top:0;- left:0;-}</style><script type="text/javascript" src="/js/ajax.js"></script><script type="text/javascript" src="/js/rss2.js"></script>+<script type="text/javascript" src="/js/query.js"></script><script type="text/javascript">var lines = new Array();-var maxlines = 360 / 9;-var maxwidth = 600 / 5;-var maxtime = 30000; // time that should be wasted until everything is scrolled+var maxlines = 20;+var maxwidth = 90;+var maxtime = 10000; // time that should be wasted until everything is scrolledvar minwait = 50; // if this is too short, the CPU will eat all performancevar maxwait = 500;var scroller = null;var idleping = null;+var loader = null;var lastwait = 1000;var tab = " ";function fillLines() {- for (var i = 0; i < maxlines; i++) {+ for (var i = 0; i < maxlines + 1; i++) {+ //addLine(i + "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789");addLine("");}}@@ -130,22 +119,36 @@ function idlepingExec() {}}-</script>+function loaderInit() {+ loader=window.setInterval("load()", 8000);+ load();+}-</head>- <body>- <div id="container">- <div id="scrollObject">- <div id="content"></div>- </div>- </div>- </body>+function load() {+ getRSS("http://localhost:8080/xml/feed.rss?set=PEERNEWS");+}++function windowsizing() {+ if (query.maxlines) maxlines = query.maxlines;+ if (query.maxwidth) maxwidth = query.maxwidth;+ if (query.maxtime) maxtime = query.maxtime;+ if (query.minwait) minwait = query.minwait;+ if (query.maxwait) maxwait = query.maxwait;+ if (query.width) {+ document.getElementById("feedbox").style.width = query.width;+ }+ if (query.height) {+ document.getElementById("feedbox").style.height = query.height;+ }+}-<script type="text/javascript">-fillLines();-idlepingInit();-getRSS("http://localhost:8080/yacysearch.rss?search=java&count=100");-//getRSS("http://news.google.com/news?output=rss");</script>+</head>++<body onload="self.getURLparameters();windowsizing();fillLines();idlepingInit();loaderInit();">+ <div id="feedbox">+ <p id="content"></p>+ </div>+</body></html>diff --git a/htroot/xml/feed.java b/htroot/xml/feed.javaindex fb00ae2c2..b96cd7a19 100755--- a/htroot/xml/feed.java+++ b/htroot/xml/feed.java@@ -47,7 +47,7 @@ public class feed {if ((post == null) || (env == null)) return prop;//boolean authorized = sb.adminAuthenticated(header) >= 2;- String channelName = post.get("channel");+ String channelName = post.get("set");if (channelName == null) return prop;RSSFeed feed = RSSFeed.channels(channelName);diff --git a/htroot/yacy/search.java b/htroot/yacy/search.javaindex 6e8d43c2f..c6ad03345 100644--- a/htroot/yacy/search.java+++ b/htroot/yacy/search.java@@ -51,6 +51,8 @@ import de.anomic.server.serverObjects;import de.anomic.server.serverProfiling;import de.anomic.server.serverSwitch;import de.anomic.tools.crypt;+import de.anomic.xml.RSSFeed;+import de.anomic.xml.RSSMessage;import de.anomic.yacy.yacyCore;import de.anomic.yacy.yacyNetwork;import de.anomic.yacy.yacySeed;@@ -125,10 +127,11 @@ public final class search {TreeSet<String> abstractSet = ((abstracts.length() == 0) || (abstracts.equals("auto"))) ? null : plasmaSearchQuery.hashes2Set(abstracts);// store accessing peer+ yacySeed remoteSeed = yacySeed.genRemoteSeed(oseed, key, true);if (yacyCore.seedDB == null) {yacyCore.log.logSevere("yacy.search: seed cache not initialized");} else {- yacyCore.peerActions.peerArrival(yacySeed.genRemoteSeed(oseed, key, true), true);+ yacyCore.peerActions.peerArrival(remoteSeed, true);}// prepare search@@ -177,6 +180,7 @@ public final class search {theQuery = new plasmaSearchQuery(null, queryhashes, excludehashes, rankingProfile, maxdist, prefer, plasmaSearchQuery.contentdomParser(contentdom), false, count, 0, filter, plasmaSearchQuery.SEARCHDOM_LOCAL, null, -1, constraint, false, yacyURL.TLD_any_zone_filter, client);theQuery.domType = plasmaSearchQuery.SEARCHDOM_LOCAL;yacyCore.log.logInfo("INIT HASH SEARCH (query-" + abstracts + "): " + plasmaSearchQuery.anonymizedQueryHashes(theQuery.queryHashes) + " - " + theQuery.displayResults() + " links");+ RSSFeed.channels("PEERNEWS").addMessage(new RSSMessage("Remote Search Request from " + remoteSeed.getName(), plasmaSearchQuery.anonymizedQueryHashes(theQuery.queryHashes)));// make eventtheSearch = plasmaSearchEvent.getEvent(theQuery, rankingProfile, sb.wordIndex, sb.crawlResults, null, true);diff --git a/source/de/anomic/plasma/plasmaSearchEvent.java b/source/de/anomic/plasma/plasmaSearchEvent.javaindex 0c085faab..7e877626c 100644--- a/source/de/anomic/plasma/plasmaSearchEvent.java+++ b/source/de/anomic/plasma/plasmaSearchEvent.java@@ -218,7 +218,7 @@ public final class plasmaSearchEvent {if (url == null) continue;//System.out.println("***DEBUG*** SEARCH RESULT URL=" + url.toNormalform(false, false));- resultEntry = obtainResultEntry(uentry, (snippetComputationAllTime < 300) ? 1 : 0);+ resultEntry = obtainResultEntry(uentry, (snippetComputationAllTime < 100) ? 1 : 0);if (resultEntry == null) continue; // the entry had some problems, cannot be usedurlRetrievalAllTime += resultEntry.dbRetrievalTime;snippetComputationAllTime += resultEntry.snippetComputationTime;@@ -350,7 +350,7 @@ public final class plasmaSearchEvent {if (query.contentdom == plasmaSearchQuery.CONTENTDOM_TEXT) {// attach text snippetstartTime = System.currentTimeMillis();- plasmaSnippetCache.TextSnippet snippet = plasmaSnippetCache.retrieveTextSnippet(comp, snippetFetchWordHashes, (snippetFetchMode == 2), ((query.constraint != null) && (query.constraint.get(plasmaCondenser.flag_cat_indexof))), 180, 3000, (snippetFetchMode == 2) ? Integer.MAX_VALUE : 100000, query.isGlobal());+ plasmaSnippetCache.TextSnippet snippet = plasmaSnippetCache.retrieveTextSnippet(comp, snippetFetchWordHashes, (snippetFetchMode == 2), ((query.constraint != null) && (query.constraint.get(plasmaCondenser.flag_cat_indexof))), 180, 3000, (snippetFetchMode == 2) ? Integer.MAX_VALUE : 30000, query.isGlobal());long snippetComputationTime = System.currentTimeMillis() - startTime;serverLog.logInfo("SEARCH_EVENT", "text snippet load time for " + comp.url() + ": " + snippetComputationTime + ", " + ((snippet.getErrorCode() < 11) ? "snippet found" : ("no snippet found (" + snippet.getError() + ")")));diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.javaindex 9436158a4..54c0fa19a 100644--- a/source/de/anomic/plasma/plasmaWordIndex.java+++ b/source/de/anomic/plasma/plasmaWordIndex.java@@ -59,6 +59,8 @@ import de.anomic.kelondro.kelondroRotateIterator;import de.anomic.kelondro.kelondroRowSet;import de.anomic.server.serverMemory;import de.anomic.server.logging.serverLog;+import de.anomic.xml.RSSFeed;+import de.anomic.xml.RSSMessage;import de.anomic.yacy.yacyDHTAction;import de.anomic.yacy.yacySeedDB;import de.anomic.yacy.yacyURL;@@ -663,6 +665,7 @@ public final class plasmaWordIndex implements indexRI {"Anchors: " + ((document.getAnchors() == null) ? 0 : document.getAnchors().size()) +"\n\tLinkStorageTime: " + (storageEndTime - startTime) + " ms | " +"indexStorageTime: " + (indexingEndTime - storageEndTime) + " ms");+ RSSFeed.channels("PEERNEWS").addMessage(new RSSMessage("Indexed web page", entry.url().toNormalform(true, false)));}// finisheddiff --git a/source/de/anomic/server/serverCore.java b/source/de/anomic/server/serverCore.javaindex 2f1891050..81124a204 100644--- a/source/de/anomic/server/serverCore.java+++ b/source/de/anomic/server/serverCore.java@@ -63,6 +63,7 @@ import java.net.Socket;import java.net.SocketException;import java.nio.channels.ClosedByInterruptException;import java.security.KeyStore;+import java.util.ConcurrentModificationException;import java.util.Enumeration;import java.util.HashMap;import java.util.HashSet;@@ -481,7 +482,13 @@ public final class serverCore extends serverAbstractBusyThread implements server// shut down all busySessionsif (this.busySessions != null) for (Session session: this.busySessions) {- try {session.interrupt();} catch (SecurityException e ) {e.printStackTrace();}+ try {+ session.interrupt();+ } catch (SecurityException e ) {+ e.printStackTrace();+ } catch (ConcurrentModificationException e) {+ e.printStackTrace();+ }}// closing the port forwarding channeldiff --git a/source/de/anomic/yacy/yacyNewsPool.java b/source/de/anomic/yacy/yacyNewsPool.javaindex c7464d429..03f17b8f5 100644--- a/source/de/anomic/yacy/yacyNewsPool.java+++ b/source/de/anomic/yacy/yacyNewsPool.java@@ -340,6 +340,9 @@ public class yacyNewsPool {// double-check with old newsif (newsDB.get(record.id()) != null) return;incomingNews.push(record);++ // add message to feed channel+ //RSSFeed.channels("PEERNEWS").addMessage(new RSSMessage("Incoming News: " + record.category() + " from " + record.originator(), record.attributes().toString()));}public int size(int dbKey) {diff --git a/source/de/anomic/yacy/yacyVersion.java b/source/de/anomic/yacy/yacyVersion.javaindex 507b573a8..97057355d 100644--- a/source/de/anomic/yacy/yacyVersion.java+++ b/source/de/anomic/yacy/yacyVersion.java@@ -37,7 +37,6 @@ import java.util.Comparator;import java.util.HashMap;import java.util.Iterator;import java.util.Map;-import java.util.SortedSet;import java.util.TreeSet;import java.util.regex.Matcher;import java.util.regex.Pattern;@@ -511,7 +510,7 @@ public final class yacyVersion implements Comparator<yacyVersion>, Comparable<yaString[] downloaded = filesPath.list();// parse all filenames and put them in a sorted set- SortedSet<yacyVersion> downloadedreleases = new TreeSet<yacyVersion>();+ TreeSet<yacyVersion> downloadedreleases = new TreeSet<yacyVersion>();for (int j = 0; j < downloaded.length; j++) {try {release = new yacyVersion(downloaded[j]);@@ -534,20 +533,18 @@ public final class yacyVersion implements Comparator<yacyVersion>, Comparable<ya// remove old fileslong now = System.currentTimeMillis();final long deleteAfterMillis = deleteAfterDays * 24 * 60 * 60000l;- String lastMain = null;- String filename;- for (final yacyVersion aRelease: downloadedreleases) {- filename = aRelease.name;- if(keepMain && aRelease.mainRelease) {- // keep this one, delete last remembered main release file- if(lastMain != null) {- filename = lastMain;- }- lastMain = aRelease.name;+ final Iterator<yacyVersion> iter = downloadedreleases.iterator();+ while (iter.hasNext()) {+ release = iter.next();++ if(keepMain && release.mainRelease) {+ // we found the latest main release+ keepMain = false;+ continue;}// check file age- File downloadedFile = new File(filesPath + File.separator + filename);+ File downloadedFile = new File(filesPath + File.separator + release.name);if(now - downloadedFile.lastModified() > deleteAfterMillis) {// delete fileif(!downloadedFile.delete()) {