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.
pull/1/head
Michael Peter Christen 12 years ago
parent f53703df62
commit c3d50d91f8

@ -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);
}

@ -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('\"');
}

@ -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);
}
}

Loading…
Cancel
Save