Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fix for wrong urls in navigator when a tenant is used
orbiter57af31162761
diff --git a/htroot/yacy/search.java b/htroot/yacy/search.javaindex ee623fc9d..6a424f982 100644--- a/htroot/yacy/search.java+++ b/htroot/yacy/search.java@@ -189,6 +189,7 @@ public final class search {abstractSet,new TreeSet<byte[]>(Base64Order.enhancedCoder),null,+ null,rankingProfile,maxdist,prefer,@@ -241,6 +242,7 @@ public final class search {queryhashes,excludehashes,null,+ null,rankingProfile,maxdist,prefer,diff --git a/htroot/yacysearch.java b/htroot/yacysearch.javaindex af3e2a5c6..97c97c135 100644--- a/htroot/yacysearch.java+++ b/htroot/yacysearch.java@@ -271,9 +271,11 @@ public class yacysearch {}}}+ String tenant = null;if (post.containsKey("tenant")) {- final String tenant = post.get("tenant");- if (urlmask == null) urlmask = ".*" + tenant + ".*"; else urlmask = ".*" + tenant + urlmask;+ tenant = post.get("tenant");+ if (tenant != null && tenant.length() == 0) tenant = null;+ if (urlmask == null && tenant != null) urlmask = ".*" + tenant + ".*"; else urlmask = ".*" + tenant + urlmask;}int site = querystring.indexOf("site:");String sitehash = null;@@ -410,6 +412,7 @@ public class yacysearch {queryHashes,Word.words2hashes(query[1]),Word.words2hashes(query[2]),+ tenant,ranking,maxDistance,prefermask,diff --git a/source/de/anomic/plasma/plasmaSearchRankingProcess.java b/source/de/anomic/plasma/plasmaSearchRankingProcess.javaindex 76a99c879..61b1d7d26 100644--- a/source/de/anomic/plasma/plasmaSearchRankingProcess.java+++ b/source/de/anomic/plasma/plasmaSearchRankingProcess.java@@ -472,12 +472,16 @@ public final class plasmaSearchRankingProcess {ArrayList<NavigatorEntry> result = new ArrayList<NavigatorEntry>();URLMetadataRow mr;yacyURL url;+ String hostname;for (int i = 0; i < rc; i++) {mr = indexSegment.urlMetadata().load(hsa[i].hashsample, null, 0);if (mr == null) continue;url = mr.metadata().url();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;}diff --git a/source/de/anomic/search/Query.java b/source/de/anomic/search/Query.javaindex e791e1796..bed77b9e6 100644--- a/source/de/anomic/search/Query.java+++ b/source/de/anomic/search/Query.java@@ -75,6 +75,7 @@ public final class Query {public String host; // this is the client host that starts the query, not a site operatorpublic String sitehash; // this is a domain hash, 6 bytes long or nullpublic String authorhash;+ public String tenant;public yacySeed remotepeer;public Long handle;// values that are set after a search:@@ -99,6 +100,7 @@ public final class Query {this.fullqueryHashes = Word.words2hashes(cq[2]);}this.ranking = ranking;+ this.tenant = null;this.maxDistance = Integer.MAX_VALUE;this.prefer = "";this.contentdom = CONTENTDOM_ALL;@@ -125,6 +127,7 @@ public final class Query {final String queryString, final TreeSet<byte[]> queryHashes,final TreeSet<byte[]> excludeHashes,final TreeSet<byte[]> fullqueryHashes,+ final String tenant,final RankingProfile ranking,final int maxDistance, final String prefer, final int contentdom,final String language,@@ -142,6 +145,7 @@ public final class Query {this.queryHashes = queryHashes;this.excludeHashes = excludeHashes;this.fullqueryHashes = fullqueryHashes;+ this.tenant = tenant;this.ranking = ranking;this.maxDistance = maxDistance;this.prefer = prefer;