Skip to content

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

fixes to web structure reference collection and url construction

orbiter5b138ada1689
diff --git a/source/de/anomic/plasma/plasmaWebStructure.java b/source/de/anomic/plasma/plasmaWebStructure.java
index accab3584..9c17aefad 100644
--- a/source/de/anomic/plasma/plasmaWebStructure.java
+++ b/source/de/anomic/plasma/plasmaWebStructure.java
@@ -259,34 +259,42 @@ public class plasmaWebStructure {
}
public structureEntry incomingReferences(final String domhash) {
+ String host = resolveDomHash2DomString(domhash);
+ if (host == null) return null;
// collect the references
- final Iterator<plasmaWebStructure.structureEntry> i = structureEntryIterator(false);
plasmaWebStructure.structureEntry sentry;
HashMap<String, Integer> domhashes = new HashMap<String, Integer>();
+ Iterator<plasmaWebStructure.structureEntry> i = structureEntryIterator(false);
while (i.hasNext()) {
sentry = i.next();
- if (sentry.references.containsKey(domhash)) {
- domhashes.put(sentry.domhash, sentry.references.get(domhash));
- }
+ if (sentry.references.containsKey(domhash)) domhashes.put(sentry.domhash, sentry.references.get(domhash));
+ }
+ i = structureEntryIterator(true);
+ while (i.hasNext()) {
+ sentry = i.next();
+ if (sentry.references.containsKey(domhash)) domhashes.put(sentry.domhash, sentry.references.get(domhash));
}
// construct a new structureEntry Object
return new structureEntry(
domhash,
- resolveDomHash2DomString(domhash),
+ host,
DateFormatter.formatShortDay(new Date()),
domhashes);
}
public HashMap<String, Integer> incomingDomains(final String domhash) {
// collect the references
- final Iterator<plasmaWebStructure.structureEntry> i = structureEntryIterator(false);
plasmaWebStructure.structureEntry sentry;
HashMap<String, Integer> domains = new HashMap<String, Integer>();
+ Iterator<plasmaWebStructure.structureEntry> i = structureEntryIterator(false);
while (i.hasNext()) {
sentry = i.next();
- if (sentry.references.containsKey(domhash)) {
- domains.put(sentry.domain, sentry.references.get(domhash));
- }
+ if (sentry.references.containsKey(domhash)) domains.put(sentry.domain, sentry.references.get(domhash));
+ }
+ i = structureEntryIterator(true);
+ while (i.hasNext()) {
+ sentry = i.next();
+ if (sentry.references.containsKey(domhash)) domains.put(sentry.domain, sentry.references.get(domhash));
}
return domains;
}
diff --git a/source/de/anomic/yacy/dht/Transmission.java b/source/de/anomic/yacy/dht/Transmission.java
index 5b1be66b0..40c7745fd 100644
--- a/source/de/anomic/yacy/dht/Transmission.java
+++ b/source/de/anomic/yacy/dht/Transmission.java
@@ -227,12 +227,12 @@ public class Transmission {
}
public boolean isFinished() {
- System.out.println("canFinish: hit = " + this.hit + ", redundancy = " + seeds.redundancy() + ", targets.size() = " + targets.size());
+ //System.out.println("canFinish: hit = " + this.hit + ", redundancy = " + seeds.redundancy() + ", targets.size() = " + targets.size());
return this.hit >= seeds.redundancy();
}
public boolean canFinish() {
- System.out.println("canFinish: hit = " + this.hit + ", redundancy = " + seeds.redundancy() + ", targets.size() = " + targets.size());
+ //System.out.println("canFinish: hit = " + this.hit + ", redundancy = " + seeds.redundancy() + ", targets.size() = " + targets.size());
return this.targets.size() >= seeds.redundancy() - this.hit;
}
diff --git a/source/de/anomic/yacy/yacyURL.java b/source/de/anomic/yacy/yacyURL.java
index 34a87a593..301b76fd0 100644
--- a/source/de/anomic/yacy/yacyURL.java
+++ b/source/de/anomic/yacy/yacyURL.java
@@ -79,12 +79,8 @@ public class yacyURL implements Serializable {
url = url.trim();
int p = url.indexOf(':');
if (p < 0) {
- if (url.startsWith("www.")) {
- url = "http://" + url;
- p = 4;
- } else {
- throw new MalformedURLException("protocol is not given in '" + url + "'");
- }
+ url = "http://" + url;
+ p = 4;
}
this.protocol = url.substring(0, p).toLowerCase().trim();
if (url.length() < p + 4) throw new MalformedURLException("URL not parseable: '" + url + "'");