fix for wrong urls in navigator when a tenant is used

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6119 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 16 years ago
parent 76b96337e2
commit 57af311627

@ -189,6 +189,7 @@ public final class search {
abstractSet, abstractSet,
new TreeSet<byte[]>(Base64Order.enhancedCoder), new TreeSet<byte[]>(Base64Order.enhancedCoder),
null, null,
null,
rankingProfile, rankingProfile,
maxdist, maxdist,
prefer, prefer,
@ -241,6 +242,7 @@ public final class search {
queryhashes, queryhashes,
excludehashes, excludehashes,
null, null,
null,
rankingProfile, rankingProfile,
maxdist, maxdist,
prefer, prefer,

@ -271,9 +271,11 @@ public class yacysearch {
} }
} }
} }
String tenant = null;
if (post.containsKey("tenant")) { if (post.containsKey("tenant")) {
final String tenant = post.get("tenant"); tenant = post.get("tenant");
if (urlmask == null) urlmask = ".*" + tenant + ".*"; else urlmask = ".*" + tenant + urlmask; if (tenant != null && tenant.length() == 0) tenant = null;
if (urlmask == null && tenant != null) urlmask = ".*" + tenant + ".*"; else urlmask = ".*" + tenant + urlmask;
} }
int site = querystring.indexOf("site:"); int site = querystring.indexOf("site:");
String sitehash = null; String sitehash = null;
@ -410,6 +412,7 @@ public class yacysearch {
queryHashes, queryHashes,
Word.words2hashes(query[1]), Word.words2hashes(query[1]),
Word.words2hashes(query[2]), Word.words2hashes(query[2]),
tenant,
ranking, ranking,
maxDistance, maxDistance,
prefermask, prefermask,

@ -472,12 +472,16 @@ public final class plasmaSearchRankingProcess {
ArrayList<NavigatorEntry> result = new ArrayList<NavigatorEntry>(); ArrayList<NavigatorEntry> result = new ArrayList<NavigatorEntry>();
URLMetadataRow mr; URLMetadataRow mr;
yacyURL url; yacyURL url;
String hostname;
for (int i = 0; i < rc; i++) { for (int i = 0; i < rc; i++) {
mr = indexSegment.urlMetadata().load(hsa[i].hashsample, null, 0); mr = indexSegment.urlMetadata().load(hsa[i].hashsample, null, 0);
if (mr == null) continue; if (mr == null) continue;
url = mr.metadata().url(); url = mr.metadata().url();
if (url == null) continue; if (url == null) continue;
result.add(new NavigatorEntry(url.getHost(), hsa[i].count)); hostname = url.getHost();
if (hostname == null) continue;
if (query.tenant != null && !hostname.contains(query.tenant)) continue;
result.add(new NavigatorEntry(hostname, hsa[i].count));
} }
return result; return result;
} }

@ -75,6 +75,7 @@ public final class Query {
public String host; // this is the client host that starts the query, not a site operator public String host; // this is the client host that starts the query, not a site operator
public String sitehash; // this is a domain hash, 6 bytes long or null public String sitehash; // this is a domain hash, 6 bytes long or null
public String authorhash; public String authorhash;
public String tenant;
public yacySeed remotepeer; public yacySeed remotepeer;
public Long handle; public Long handle;
// values that are set after a search: // values that are set after a search:
@ -99,6 +100,7 @@ public final class Query {
this.fullqueryHashes = Word.words2hashes(cq[2]); this.fullqueryHashes = Word.words2hashes(cq[2]);
} }
this.ranking = ranking; this.ranking = ranking;
this.tenant = null;
this.maxDistance = Integer.MAX_VALUE; this.maxDistance = Integer.MAX_VALUE;
this.prefer = ""; this.prefer = "";
this.contentdom = CONTENTDOM_ALL; this.contentdom = CONTENTDOM_ALL;
@ -125,6 +127,7 @@ public final class Query {
final String queryString, final TreeSet<byte[]> queryHashes, final String queryString, final TreeSet<byte[]> queryHashes,
final TreeSet<byte[]> excludeHashes, final TreeSet<byte[]> excludeHashes,
final TreeSet<byte[]> fullqueryHashes, final TreeSet<byte[]> fullqueryHashes,
final String tenant,
final RankingProfile ranking, final RankingProfile ranking,
final int maxDistance, final String prefer, final int contentdom, final int maxDistance, final String prefer, final int contentdom,
final String language, final String language,
@ -142,6 +145,7 @@ public final class Query {
this.queryHashes = queryHashes; this.queryHashes = queryHashes;
this.excludeHashes = excludeHashes; this.excludeHashes = excludeHashes;
this.fullqueryHashes = fullqueryHashes; this.fullqueryHashes = fullqueryHashes;
this.tenant = tenant;
this.ranking = ranking; this.ranking = ranking;
this.maxDistance = maxDistance; this.maxDistance = maxDistance;
this.prefer = prefer; this.prefer = prefer;

Loading…
Cancel
Save