diff --git a/htroot/HostBrowser.java b/htroot/HostBrowser.java index 65a07d324..fbcf13738 100644 --- a/htroot/HostBrowser.java +++ b/htroot/HostBrowser.java @@ -287,7 +287,7 @@ public class HostBrowser { // get all files for a specific host from the index StringBuilder q = new StringBuilder(); - if (host != null) q.append(CollectionSchema.host_s.getSolrFieldName()).append(':').append(host); + if (host != null) q.append(CollectionSchema.host_s.getSolrFieldName()).append(":\"").append(host).append("\""); if (pathparts.length > 0 && pathparts[0].length() > 0) { for (String pe: pathparts) { if (pe.length() > 0) q.append(" AND ").append(CollectionSchema.url_paths_sxt.getSolrFieldName()).append(":\"").append(pe).append('\"'); diff --git a/source/net/yacy/cora/document/id/DigestURL.java b/source/net/yacy/cora/document/id/DigestURL.java index b4c9b0822..4ebdd8950 100644 --- a/source/net/yacy/cora/document/id/DigestURL.java +++ b/source/net/yacy/cora/document/id/DigestURL.java @@ -230,7 +230,7 @@ public class DigestURL extends MultiProtocolURL implements Serializable { final int id = Domains.getDomainID(this.host, this.hostAddress); // id=7: tld is local final boolean isHTTP = isHTTP(); - int p = (this.host == null) ? -1 : this.host.lastIndexOf('.'); + int p = (this.host == null || this.host.indexOf(':') >= 0) ? -1 : this.host.lastIndexOf('.'); String dom = (p > 0) ? dom = this.host.substring(0, p) : ""; p = dom.lastIndexOf('.'); // locate subdomain final String subdom; @@ -295,8 +295,11 @@ public class DigestURL extends MultiProtocolURL implements Serializable { if (host == null) { return Base64Order.enhancedCoder.encode(Digest.encodeMD5Raw(protocol)).substring(0, 5); } + boolean isIPv6HostIP = host.indexOf(':') >= 0; final StringBuilder sb = new StringBuilder(host.length() + 15); - sb.append(protocol).append(':').append(host).append(':').append(Integer.toString(port)); + sb.append(protocol).append(':'); + if (isIPv6HostIP) {sb.append('[').append(host).append(']');} else sb.append(host); + sb.append(':').append(Integer.toString(port)); return Base64Order.enhancedCoder.encode(Digest.encodeMD5Raw(sb.toString())).substring(0, 5); } diff --git a/source/net/yacy/cora/document/id/MultiProtocolURL.java b/source/net/yacy/cora/document/id/MultiProtocolURL.java index 51c44e82f..d2161238c 100644 --- a/source/net/yacy/cora/document/id/MultiProtocolURL.java +++ b/source/net/yacy/cora/document/id/MultiProtocolURL.java @@ -2069,7 +2069,8 @@ public class MultiProtocolURL implements Serializable, Comparable= 0) {sb.append('[').append(host).append(']');} else sb.append(host); + sb.append(':').append(Integer.toString(port)); return sb.toString(); }