Skip to content

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

relaxing site operator for www prefix: - when using a site operator search for a domain where the domain has a www prefix, also the domain without the www is enclosed - when using a site operator search for a domain where the domain has no www prefix, also the domain with the www in enclosed - in the host navigator, all domains with and without a www prefix are accumulated. That means that the host navigator does never show a host with a www prefix. This should prevent usage mistakes of the site operator.

Michael Peter Christenc3d50d91f829
diff --git a/source/net/yacy/peers/Protocol.java b/source/net/yacy/peers/Protocol.java
index ada7e194d..65735d010 100644
--- a/source/net/yacy/peers/Protocol.java
+++ b/source/net/yacy/peers/Protocol.java
@@ -1093,7 +1093,11 @@ public final class Protocol
ReversibleScoreMap<String> result = new ClusteredScoreMap<String>(UTF8.insensitiveUTF8Comparator);
List<Count> values = facet == null ? null : facet.getValues();
if (values == null) continue;
- for (Count ff: values) result.set(ff.getName(), (int) ff.getCount());
+ for (Count ff: values) {
+ int c = (int) ff.getCount();
+ if (c == 0) continue;
+ result.set(ff.getName(), c);
+ }
facets.put(field, result);
}
diff --git a/source/net/yacy/search/query/QueryParams.java b/source/net/yacy/search/query/QueryParams.java
index 9751eaf7b..438d11380 100644
--- a/source/net/yacy/search/query/QueryParams.java
+++ b/source/net/yacy/search/query/QueryParams.java
@@ -451,9 +451,16 @@ public final class QueryParams {
}
}
} else {
- if (this.nav_sitehost != null)
- fq.append(" AND ").append(YaCySchema.host_s.getSolrFieldName()).append(":\"").append(this.nav_sitehost).append('\"');
- else
+ if (this.nav_sitehost != null) {
+ // consider to search for hosts with 'www'-prefix, if not already part of the host name
+ if (this.nav_sitehost.startsWith("www.")) {
+ fq.append(" AND (").append(YaCySchema.host_s.getSolrFieldName()).append(":\"").append(this.nav_sitehost.substring(4)).append('\"');
+ fq.append(" OR ").append(YaCySchema.host_s.getSolrFieldName()).append(":\"").append(this.nav_sitehost).append("\")");
+ } else {
+ fq.append(" AND (").append(YaCySchema.host_s.getSolrFieldName()).append(":\"").append(this.nav_sitehost).append('\"');
+ fq.append(" OR ").append(YaCySchema.host_s.getSolrFieldName()).append(":\"www.").append(this.nav_sitehost).append("\")");
+ }
+ } else
fq.append(" AND ").append(YaCySchema.host_id_s.getSolrFieldName()).append(":\"").append(this.nav_sitehash).append('\"');
}
diff --git a/source/net/yacy/search/query/SearchEvent.java b/source/net/yacy/search/query/SearchEvent.java
index 6e39a22ce..fe73af4ff 100644
--- a/source/net/yacy/search/query/SearchEvent.java
+++ b/source/net/yacy/search/query/SearchEvent.java
@@ -496,7 +496,13 @@ public final class SearchEvent {
if (this.hostNavigator != null) {
fcts = facets.get(YaCySchema.host_s.getSolrFieldName());
if (fcts != null) {
- this.hostNavigator.inc(fcts);
+ for (String host: fcts) {
+ int hc = fcts.get(host);
+ if (hc == 0) continue;
+ if (host.startsWith("www.")) host = host.substring(4);
+ this.hostNavigator.inc(host, hc);
+ }
+ //this.hostNavigator.inc(fcts);
}
}