- more constants

- display why global search is not available on search page

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3839 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
karlchenofhell 18 years ago
parent d8951422f9
commit 6265d321bd

@ -58,9 +58,16 @@
<td><label for="resource">Resource</label>:</td> <td><label for="resource">Resource</label>:</td>
<td> <td>
<select id="resource" name="resource"> <select id="resource" name="resource">
<option value="global" #(resource-global)#::selected="selected"#(/resource-global)#>global</option> <option value="global" #(resource-global)#::selected="selected"#(/resource-global)#
#(resource-global-disabled)#::disabled="disabled"#(/resource-global-disabled)#>global</option>
<option value="local" #(resource-local)#::selected="selected"#(/resource-local)#>local</option> <option value="local" #(resource-local)#::selected="selected"#(/resource-local)#>local</option>
</select> </select>
#(resource-global-disabled)#::
Global search is disabled because<br />#(reason)#
<a class="lock" href="ConfigNetwork_p.html">DHT Distribution</a> is::
<a class="lock" href="ConfigNetwork_p.html">Index Receive</a> is::
<a class="lock" href="ConfigNetwork_p.html">DHT Distribution and Index Receive</a> are#(/reason)#
disabled.#(/resource-global-disabled)#
</td> </td>
</tr> </tr>
<tr> <tr>

@ -74,11 +74,14 @@ public class index {
final String cat = (post == null) ? "href" : post.get("cat", "href"); final String cat = (post == null) ? "href" : post.get("cat", "href");
final int type = (post == null) ? 0 : post.getInt("type", 0); final int type = (post == null) ? 0 : post.getInt("type", 0);
final boolean indexDistributeGranted = sb.getConfig(plasmaSwitchboard.INDEX_DIST_ALLOW, "true").equals("true"); final boolean indexDistributeGranted = sb.getConfigBool(plasmaSwitchboard.INDEX_DIST_ALLOW, true);
final boolean indexReceiveGranted = sb.getConfig("allowReceiveIndex", "true").equals("true"); final boolean indexReceiveGranted = sb.getConfigBool(plasmaSwitchboard.INDEX_RECEIVE_ALLOW, true);
if (!indexDistributeGranted || !indexReceiveGranted) { global = false; } 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) { if (referer != null) {
URL url; URL url;
try { try {
@ -89,8 +92,8 @@ public class index {
if ((url != null) && (serverCore.isNotLocal(url))) { if ((url != null) && (serverCore.isNotLocal(url))) {
final HashMap referrerprop = new HashMap(); final HashMap referrerprop = new HashMap();
referrerprop.put("count", "1"); referrerprop.put("count", "1");
referrerprop.put("clientip", header.get("CLIENTIP")); referrerprop.put("clientip", header.get(httpHeader.CONNECTION_PROP_CLIENTIP));
referrerprop.put("useragent", header.get("User-Agent")); referrerprop.put("useragent", header.get(httpHeader.USER_AGENT));
referrerprop.put("date", (new serverDate()).toShortString(false)); referrerprop.put("date", (new serverDate()).toShortString(false));
if (sb.facilityDB != null) try {sb.facilityDB.update("backlinks", referer, referrerprop);} catch (IOException e) {} 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-100", (count == 100) ? 1 : 0);
prop.put("searchoptions_count-1000", (count == 1000) ? 1 : 0); prop.put("searchoptions_count-1000", (count == 1000) ? 1 : 0);
prop.put("searchoptions_resource-global", ((global) ? 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_resource-local", ((global) ? 0 : 1));
prop.put("searchoptions_time-1", (time == 1) ? 1 : 0); prop.put("searchoptions_time-1", (time == 1) ? 1 : 0);
prop.put("searchoptions_time-3", (time == 3) ? 1 : 0); prop.put("searchoptions_time-3", (time == 3) ? 1 : 0);

@ -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_PREFETCH_DEPTH = "proxyPrefetchDepth";
public static final String PROXY_CRAWL_ORDER = "proxyCrawlOrder"; 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_SIZE = "proxyCacheSize";
/** /**
* <p><code>public static final String <strong>PROXY_CACHE_LAYOUT</strong> = "proxyCacheLayout"</code></p> * <p><code>public static final String <strong>PROXY_CACHE_LAYOUT</strong> = "proxyCacheLayout"</code></p>
@ -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_LAYOUT_HASH = "hash";
public static final String PROXY_CACHE_MIGRATION = "proxyCacheMigration"; 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 // Miscellaneous settings
////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////
@ -1354,8 +1368,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
public boolean isPublicRobinson() { public boolean isPublicRobinson() {
// robinson peers may be member of robinson clusters, which can be public or private // 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 // this does not check the robinson attribute, only the specific subtype of the cluster
String clustermode = getConfig("cluster.mode", "publicpeer"); String clustermode = getConfig(CLUSTER_MODE, CLUSTER_MODE_PUBLIC_PEER);
return (clustermode.equals("publiccluster")) || (clustermode.equals("publicepeer")); return (clustermode.equals(CLUSTER_MODE_PUBLIC_CLUSTER)) || (clustermode.equals(CLUSTER_MODE_PUBLIC_PEER));
} }
public boolean isInMyCluster(String 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 // or a ip:port String or simply a ip String
// if this robinson mode does not define a cluster membership, false is returned // if this robinson mode does not define a cluster membership, false is returned
if (!isRobinsonMode()) return false; if (!isRobinsonMode()) return false;
String clustermode = getConfig("cluster.mode", "publicpeer"); String clustermode = getConfig(CLUSTER_MODE, CLUSTER_MODE_PUBLIC_PEER);
if (clustermode.equals("privatecluster")) { if (clustermode.equals(CLUSTER_MODE_PRIVATE_CLUSTER)) {
// check if we got the request from a peer in the 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; 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 // check if we got the request from a peer in the public cluster
return this.clusterhashes.containsKey(peer); return this.clusterhashes.containsKey(peer);
} else { } 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 this robinson mode does not define a cluster membership, false is returned
if (seed == null) return false; if (seed == null) return false;
if (!isRobinsonMode()) return false; if (!isRobinsonMode()) return false;
String clustermode = getConfig("cluster.mode", "publicpeer"); String clustermode = getConfig(CLUSTER_MODE, CLUSTER_MODE_PUBLIC_PEER);
if (clustermode.equals("privatecluster")) { if (clustermode.equals(CLUSTER_MODE_PRIVATE_CLUSTER)) {
// check if we got the request from a peer in the 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; 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 // check if we got the request from a peer in the public cluster
return this.clusterhashes.containsKey(seed.hash); return this.clusterhashes.containsKey(seed.hash);
} else { } else {
@ -1463,13 +1477,13 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
if (this.defaultProxyProfile == null) { if (this.defaultProxyProfile == null) {
// generate new default entry for proxy crawling // generate new default entry for proxy crawling
this.defaultProxyProfile = this.profiles.newEntry("proxy", "", ".*", ".*", this.defaultProxyProfile = this.profiles.newEntry("proxy", "", ".*", ".*",
Integer.parseInt(getConfig("proxyPrefetchDepth", "0")), Integer.parseInt(getConfig(PROXY_PREFETCH_DEPTH, "0")),
Integer.parseInt(getConfig("proxyPrefetchDepth", "0")), Integer.parseInt(getConfig(PROXY_PREFETCH_DEPTH, "0")),
60 * 24, -1, -1, false, 60 * 24, -1, -1, false,
getConfigBool("proxyIndexingLocalText", true), getConfigBool(PROXY_INDEXING_LOCAL_TEXT, true),
getConfigBool("proxyIndexingLocalMedia", true), getConfigBool(PROXY_INDEXING_LOCAL_MEDIA, true),
true, true, true, true,
getConfigBool("proxyIndexingRemote", false), true, true, true); getConfigBool(PROXY_INDEXING_REMOTE, false), true, true, true);
} }
if (this.defaultRemoteProfile == null) { if (this.defaultRemoteProfile == null) {
// generate new default entry for remote crawling // generate new default entry for remote crawling
@ -2016,8 +2030,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
return false; return false;
} }
boolean robinsonPrivateCase = ((isRobinsonMode()) && boolean robinsonPrivateCase = ((isRobinsonMode()) &&
(!getConfig("cluster.mode", "").equals("publiccluster")) && (!getConfig(CLUSTER_MODE, "").equals(CLUSTER_MODE_PUBLIC_CLUSTER)) &&
(!getConfig("cluster.mode", "").equals("privatecluster"))); (!getConfig(CLUSTER_MODE, "").equals(CLUSTER_MODE_PRIVATE_CLUSTER)));
if ((robinsonPrivateCase) || ((coreCrawlJobSize() <= 20) && (limitCrawlTriggerJobSize() > 10))) { if ((robinsonPrivateCase) || ((coreCrawlJobSize() <= 20) && (limitCrawlTriggerJobSize() > 10))) {
// it is not efficient if the core crawl job is empty and we have too much to do // 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++) { for (int i = 0; i < toshift; i++) {
noticeURL.shift(plasmaCrawlNURL.STACK_TYPE_LIMIT, plasmaCrawlNURL.STACK_TYPE_CORE); 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; if (robinsonPrivateCase) return false;
} }

Loading…
Cancel
Save