Skip to content

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

add canonical links to the same crawldepth, not the next crawldepth

Michael Peter Christen5746aae3db80
diff --git a/source/net/yacy/document/Document.java b/source/net/yacy/document/Document.java
index 71b8b79e2..1d901f99c 100644
--- a/source/net/yacy/document/Document.java
+++ b/source/net/yacy/document/Document.java
@@ -907,6 +907,8 @@ dc_rights
return newDoc;
}
+ public final static String CANONICAL_MARKER = "canonical";
+
public static Map<DigestURL, String> getHyperlinks(final Document[] documents) {
final Map<DigestURL, String> result = new HashMap<DigestURL, String>();
for (final Document d: documents) {
@@ -917,7 +919,9 @@ dc_rights
String refresh = html.getRefreshPath();
if (refresh != null && refresh.length() > 0) try {result.put(new DigestURL(refresh), "refresh");} catch (final MalformedURLException e) {}
DigestURL canonical = html.getCanonical();
- if (canonical != null) result.put(canonical, "canonical");
+ if (canonical != null) {
+ result.put(canonical, CANONICAL_MARKER);
+ }
}
}
return result;
diff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.java
index a7705abdd..111c716d0 100644
--- a/source/net/yacy/search/Switchboard.java
+++ b/source/net/yacy/search/Switchboard.java
@@ -2634,6 +2634,7 @@ public final class Switchboard extends serverSwitch {
//if (m.matches()) u = m.replaceAll("");
// enqueue the hyperlink into the pre-notice-url db
+ int nextdepth = nextEntry.getValue() != null && nextEntry.getValue().equals(Document.CANONICAL_MARKER) ? response.depth() : response.depth() + 1; // canonical documents are on the same depth
try {
this.crawlStacker.enqueueEntry(new Request(
response.initiator(),
@@ -2642,7 +2643,7 @@ public final class Switchboard extends serverSwitch {
nextEntry.getValue(),
new Date(),
response.profile().handle(),
- response.depth() + 1,
+ nextdepth,
0,
0));
} catch (final MalformedURLException e ) {