diff --git a/htroot/index.java b/htroot/index.java
index 1265d10b0..5a54bbe90 100644
--- a/htroot/index.java
+++ b/htroot/index.java
@@ -74,11 +74,14 @@ public class index {
final String cat = (post == null) ? "href" : post.get("cat", "href");
final int type = (post == null) ? 0 : post.getInt("type", 0);
- final boolean indexDistributeGranted = sb.getConfig(plasmaSwitchboard.INDEX_DIST_ALLOW, "true").equals("true");
- final boolean indexReceiveGranted = sb.getConfig("allowReceiveIndex", "true").equals("true");
+ final boolean indexDistributeGranted = sb.getConfigBool(plasmaSwitchboard.INDEX_DIST_ALLOW, true);
+ final boolean indexReceiveGranted = sb.getConfigBool(plasmaSwitchboard.INDEX_RECEIVE_ALLOW, true);
if (!indexDistributeGranted || !indexReceiveGranted) { global = false; }
+ final boolean clustersearch = sb.isRobinsonMode() &&
+ (sb.getConfig(plasmaSwitchboard.CLUSTER_MODE, "").equals(plasmaSwitchboard.CLUSTER_MODE_PRIVATE_CLUSTER) ||
+ sb.getConfig(plasmaSwitchboard.CLUSTER_MODE, "").equals(plasmaSwitchboard.CLUSTER_MODE_PUBLIC_CLUSTER));
- final String referer = (String) header.get("Referer");
+ final String referer = (String) header.get(httpHeader.REFERER);
if (referer != null) {
URL url;
try {
@@ -89,8 +92,8 @@ public class index {
if ((url != null) && (serverCore.isNotLocal(url))) {
final HashMap referrerprop = new HashMap();
referrerprop.put("count", "1");
- referrerprop.put("clientip", header.get("CLIENTIP"));
- referrerprop.put("useragent", header.get("User-Agent"));
+ referrerprop.put("clientip", header.get(httpHeader.CONNECTION_PROP_CLIENTIP));
+ referrerprop.put("useragent", header.get(httpHeader.USER_AGENT));
referrerprop.put("date", (new serverDate()).toShortString(false));
if (sb.facilityDB != null) try {sb.facilityDB.update("backlinks", referer, referrerprop);} catch (IOException e) {}
}
@@ -126,6 +129,8 @@ public class index {
prop.put("searchoptions_count-100", (count == 100) ? 1 : 0);
prop.put("searchoptions_count-1000", (count == 1000) ? 1 : 0);
prop.put("searchoptions_resource-global", ((global) ? 1 : 0));
+ prop.put("searchoptions_resource-global-disabled", (global || clustersearch) ? 0 : 1);
+ prop.put("searchoptions_resource-global-disabled_reason", (indexReceiveGranted) ? 0 : (indexDistributeGranted) ? 1 : 2);
prop.put("searchoptions_resource-local", ((global) ? 0 : 1));
prop.put("searchoptions_time-1", (time == 1) ? 1 : 0);
prop.put("searchoptions_time-3", (time == 3) ? 1 : 0);
diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java
index 0c153814e..7ab51afe7 100644
--- a/source/de/anomic/plasma/plasmaSwitchboard.java
+++ b/source/de/anomic/plasma/plasmaSwitchboard.java
@@ -582,6 +582,10 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
public static final String PROXY_PREFETCH_DEPTH = "proxyPrefetchDepth";
public static final String PROXY_CRAWL_ORDER = "proxyCrawlOrder";
+ public static final String PROXY_INDEXING_REMOTE = "proxyIndexingRemote";
+ public static final String PROXY_INDEXING_LOCAL_TEXT = "proxyIndexingLocalText";
+ public static final String PROXY_INDEXING_LOCAL_MEDIA = "proxyIndexingLocalMedia";
+
public static final String PROXY_CACHE_SIZE = "proxyCacheSize";
/**
*
public static final String PROXY_CACHE_LAYOUT = "proxyCacheLayout"
@@ -632,6 +636,16 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
public static final String PROXY_CACHE_LAYOUT_HASH = "hash";
public static final String PROXY_CACHE_MIGRATION = "proxyCacheMigration";
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ // Cluster settings
+ //////////////////////////////////////////////////////////////////////////////////////////////
+
+ public static final String CLUSTER_MODE = "cluster.mode";
+ public static final String CLUSTER_MODE_PUBLIC_CLUSTER = "publiccluster";
+ public static final String CLUSTER_MODE_PRIVATE_CLUSTER = "privatecluster";
+ public static final String CLUSTER_MODE_PUBLIC_PEER = "publicpeer";
+ public static final String CLUSTER_PEERS_IPPORT = "cluster.peers.ipport";
+
//////////////////////////////////////////////////////////////////////////////////////////////
// Miscellaneous settings
//////////////////////////////////////////////////////////////////////////////////////////////
@@ -1354,8 +1368,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
public boolean isPublicRobinson() {
// robinson peers may be member of robinson clusters, which can be public or private
// this does not check the robinson attribute, only the specific subtype of the cluster
- String clustermode = getConfig("cluster.mode", "publicpeer");
- return (clustermode.equals("publiccluster")) || (clustermode.equals("publicepeer"));
+ String clustermode = getConfig(CLUSTER_MODE, CLUSTER_MODE_PUBLIC_PEER);
+ return (clustermode.equals(CLUSTER_MODE_PUBLIC_CLUSTER)) || (clustermode.equals(CLUSTER_MODE_PUBLIC_PEER));
}
public boolean isInMyCluster(String peer) {
@@ -1364,12 +1378,12 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// or a ip:port String or simply a ip String
// if this robinson mode does not define a cluster membership, false is returned
if (!isRobinsonMode()) return false;
- String clustermode = getConfig("cluster.mode", "publicpeer");
- if (clustermode.equals("privatecluster")) {
+ String clustermode = getConfig(CLUSTER_MODE, CLUSTER_MODE_PUBLIC_PEER);
+ if (clustermode.equals(CLUSTER_MODE_PRIVATE_CLUSTER)) {
// check if we got the request from a peer in the private cluster
- String network = getConfig("cluster.peers.ipport", "");
+ String network = getConfig(CLUSTER_PEERS_IPPORT, "");
return network.indexOf(peer) >= 0;
- } else if (clustermode.equals("publiccluster")) {
+ } else if (clustermode.equals(CLUSTER_MODE_PUBLIC_CLUSTER)) {
// check if we got the request from a peer in the public cluster
return this.clusterhashes.containsKey(peer);
} else {
@@ -1382,12 +1396,12 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// if this robinson mode does not define a cluster membership, false is returned
if (seed == null) return false;
if (!isRobinsonMode()) return false;
- String clustermode = getConfig("cluster.mode", "publicpeer");
- if (clustermode.equals("privatecluster")) {
+ String clustermode = getConfig(CLUSTER_MODE, CLUSTER_MODE_PUBLIC_PEER);
+ if (clustermode.equals(CLUSTER_MODE_PRIVATE_CLUSTER)) {
// check if we got the request from a peer in the private cluster
- String network = getConfig("cluster.peers.ipport", "");
+ String network = getConfig(CLUSTER_PEERS_IPPORT, "");
return network.indexOf(seed.getPublicAddress()) >= 0;
- } else if (clustermode.equals("publiccluster")) {
+ } else if (clustermode.equals(CLUSTER_MODE_PUBLIC_CLUSTER)) {
// check if we got the request from a peer in the public cluster
return this.clusterhashes.containsKey(seed.hash);
} else {
@@ -1463,13 +1477,13 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
if (this.defaultProxyProfile == null) {
// generate new default entry for proxy crawling
this.defaultProxyProfile = this.profiles.newEntry("proxy", "", ".*", ".*",
- Integer.parseInt(getConfig("proxyPrefetchDepth", "0")),
- Integer.parseInt(getConfig("proxyPrefetchDepth", "0")),
+ Integer.parseInt(getConfig(PROXY_PREFETCH_DEPTH, "0")),
+ Integer.parseInt(getConfig(PROXY_PREFETCH_DEPTH, "0")),
60 * 24, -1, -1, false,
- getConfigBool("proxyIndexingLocalText", true),
- getConfigBool("proxyIndexingLocalMedia", true),
+ getConfigBool(PROXY_INDEXING_LOCAL_TEXT, true),
+ getConfigBool(PROXY_INDEXING_LOCAL_MEDIA, true),
true, true,
- getConfigBool("proxyIndexingRemote", false), true, true, true);
+ getConfigBool(PROXY_INDEXING_REMOTE, false), true, true, true);
}
if (this.defaultRemoteProfile == null) {
// generate new default entry for remote crawling
@@ -2016,8 +2030,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
return false;
}
boolean robinsonPrivateCase = ((isRobinsonMode()) &&
- (!getConfig("cluster.mode", "").equals("publiccluster")) &&
- (!getConfig("cluster.mode", "").equals("privatecluster")));
+ (!getConfig(CLUSTER_MODE, "").equals(CLUSTER_MODE_PUBLIC_CLUSTER)) &&
+ (!getConfig(CLUSTER_MODE, "").equals(CLUSTER_MODE_PRIVATE_CLUSTER)));
if ((robinsonPrivateCase) || ((coreCrawlJobSize() <= 20) && (limitCrawlTriggerJobSize() > 10))) {
// it is not efficient if the core crawl job is empty and we have too much to do
@@ -2027,7 +2041,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
for (int i = 0; i < toshift; i++) {
noticeURL.shift(plasmaCrawlNURL.STACK_TYPE_LIMIT, plasmaCrawlNURL.STACK_TYPE_CORE);
}
- log.logInfo("shifted " + toshift + " jobs from global crawl to local crawl (coreCrawlJobSize()=" + coreCrawlJobSize() + ", limitCrawlTriggerJobSize()=" + limitCrawlTriggerJobSize() + ", cluster.mode=" + getConfig("cluster.mode", "") + ", robinsonMode=" + ((isRobinsonMode()) ? "on" : "off"));
+ log.logInfo("shifted " + toshift + " jobs from global crawl to local crawl (coreCrawlJobSize()=" + coreCrawlJobSize() + ", limitCrawlTriggerJobSize()=" + limitCrawlTriggerJobSize() + ", cluster.mode=" + getConfig(CLUSTER_MODE, "") + ", robinsonMode=" + ((isRobinsonMode()) ? "on" : "off"));
if (robinsonPrivateCase) return false;
}