Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

update to web structure picture: - allow bigger size - better instructions for api usage

orbiterfc69a7619742
diff --git a/htroot/WatchWebStructure_p.html b/htroot/WatchWebStructure_p.html
index b6b29260c..1afd9eea6 100644
--- a/htroot/WatchWebStructure_p.html
+++ b/htroot/WatchWebStructure_p.html
@@ -22,8 +22,11 @@
#%env/templates/header.template%#
#%env/templates/submenuWebStructure.template%#
-<div id="api"><a href="/api/webstructure.xml"><img src="env/grafics/api.png"></a>
-<span>The data that is visualized here can also be retrieved in a XML file. The XM L contains a back-reference of domains. That means you can see the set of domains that all link to the same (other) domain, which could be called a 'reverse domain index'.
+<div id="api"><a href="/api/webstructure.xml?about=#[besthost]#"><img src="env/grafics/api.png"></a>
+<span>
+The data that is visualized here can also be retrieved in a XML file, which lists the reference relation between the domains.
+With a GET-property 'about' you get only reference relations about the host that you give in the argument field for 'about'.
+With a GET-property 'latest' you get a list of references that had been computed during the current run-time of YaCy, and with each next call only an update to the next list of references.
Click the API icon to see the XML file.
To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de/wiki/index.php/Dev:API">API wiki page</a>.</span>
</div>
@@ -33,7 +36,8 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de
<div id="left">
<form action="/WatchWebStructure_p.html">
-<dl>
+<fieldset>
+ <dl>
<dt>host</dt>
<dd>
<input type="text" value="#[host]#" name="host" id="host" size="20" maxlength="80" />
@@ -57,14 +61,15 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de
<a href="WatchWebStructure_p.html?host=#[host]#&amp;depth=#[depth]#&amp;width=#[width]#&amp;height=#[height]#&amp;nodes=#[nodes]#&amp;time=#[timei]#"><img src="env/grafics/plus.gif" alt="plus"/></a>
</dd>
<dt>size</dt>
- <dd><input type="text" name="width" value="#[width]#" size="4" maxlength="4" />&nbsp;x&nbsp;<input type="text" name="height" value="#[height]#" size="4" maxlength="4" /></dd>
+ <dd><input type="text" name="width" value="#[width]#" size="5" maxlength="5" />&nbsp;x&nbsp;<input type="text" name="height" value="#[height]#" size="5" maxlength="5" /></dd>
<dt>&nbsp;</dt>
<dd><input type="submit" value="change" /></dd>
-</dl>
+ </dl>
+</fieldset>
</form>
-</div>
+</div><br>
-<img src="WebStructurePicture_p.png?host=#[host]#&amp;depth=#[depth]#&amp;width=#[width]#&amp;height=#[height]#&amp;nodes=#[nodes]#&amp;time=#[time]#" alt="WebStructurePicture"/>
+<img align="right" src="WebStructurePicture_p.png?host=#[besthost]#&amp;depth=#[depth]#&amp;width=#[width]#&amp;height=#[height]#&amp;nodes=#[nodes]#&amp;time=#[time]#" alt="WebStructurePicture"/>
#%env/templates/footer.template%#
</body>
diff --git a/htroot/WatchWebStructure_p.java b/htroot/WatchWebStructure_p.java
index a3fbcb9d5..987fd7d9e 100644
--- a/htroot/WatchWebStructure_p.java
+++ b/htroot/WatchWebStructure_p.java
@@ -20,6 +20,7 @@ public class WatchWebStructure_p {
int nodes = 500; // maximum number of host nodes that are painted
int time = -1;
String host = "auto";
+ String besthost;
if (post != null) {
width = post.getInt("width", 768);
@@ -49,7 +50,16 @@ public class WatchWebStructure_p {
}
}
+ // find start point
+ if ((host == null) || (host.length() == 0) || (host.equals("auto"))) {
+ // find domain with most references
+ besthost = sb.webStructure.hostWithMaxReferences();
+ } else {
+ besthost = host;
+ }
+
prop.putHTML("host", host);
+ prop.putHTML("besthost", besthost);
prop.put("depth", depth);
prop.put("depthi", Math.min(8, depth + 1));
prop.put("depthd", Math.max(0, depth - 1));
diff --git a/htroot/WebStructurePicture_p.java b/htroot/WebStructurePicture_p.java
index 1d7756677..447a1ad93 100644
--- a/htroot/WebStructurePicture_p.java
+++ b/htroot/WebStructurePicture_p.java
@@ -65,11 +65,11 @@ public class WebStructurePicture_p {
host = post.get("host", null);
}
- //too small values lead to an error, too big to huge CPU/memory consumption, resulting in possible DOS.
+ // too small values lead to an error, too big to huge CPU/memory consumption, resulting in possible DOS.
if (width < 32 ) width = 32;
- if (width > 1920) width = 1920;
+ if (width > 10000) width = 10000;
if (height < 24) height = 24;
- if (height > 1920) height = 1920;
+ if (height > 10000) height = 10000;
if (depth > 8) depth = 8;
if (depth < 0) depth = 0;
diff --git a/source/de/anomic/plasma/plasmaWebStructure.java b/source/de/anomic/plasma/plasmaWebStructure.java
index b13a779b8..353ff9400 100644
--- a/source/de/anomic/plasma/plasmaWebStructure.java
+++ b/source/de/anomic/plasma/plasmaWebStructure.java
@@ -176,7 +176,7 @@ public class plasmaWebStructure {
private static int refstr2count(final String refs) {
if ((refs == null) || (refs.length() <= 8)) return 0;
- assert (refs.length() - 8) % 10 == 0;
+ assert (refs.length() - 8) % 10 == 0 : "refs = " + refs + ", length = " + refs.length();
return (refs.length() - 8) / 10;
}
@@ -471,21 +471,20 @@ public class plasmaWebStructure {
private void next0() {
Map.Entry<String, String> entry = null;
- String dom = null, ref;
+ String dom = null, ref = "";
while (i.hasNext()) {
entry = i.next();
+ ref = entry.getValue();
+ if ((ref.length() - 8) % 10 != 0) continue;
dom = entry.getKey();
if (dom.length() >= 8) break;
- if (!i.hasNext()) {
- nextentry = null;
- return;
- }
+ dom = null;
}
if ((entry == null) || (dom == null)) {
nextentry = null;
return;
}
- ref = entry.getValue();
+ assert (ref.length() - 8) % 10 == 0 : "refs = " + ref + ", length = " + ref.length();
nextentry = new structureEntry(dom.substring(0, 6), dom.substring(7), ref.substring(0, 8), refstr2map(ref));
}