- allow lazy initialization of solr value (if using 'lazy', then no

0-values and no empty strings are written). This may save a lot of
memory (in ram and on disc) if excessive 0-values or empty strings
appear)
- do not allow default boolean values for checkboxes because that does
not make sense: browsers may omit the checkbox attribute name if the box
is not checked. A default value 'true' would not comply with the
semantic of the browsers response.
- add a checkbox in IndexFederated_p for the lazy initialization of solr
fields.
pull/1/head
Michael Peter Christen 13 years ago
parent 97f60010d8
commit 9116013c64

@ -1052,7 +1052,9 @@ federated.service.solr.indexing.enabled = false
federated.service.solr.indexing.url = http://127.0.0.1:8983/solr
federated.service.solr.indexing.commitWithinMs = 1000
federated.service.solr.indexing.sharding = MODULO_HOST_MD5
federated.service.solr.indexing.schemefile = solr.keys.default.list
federated.service.solr.indexing.schemefile = solr.keys.default.list
# the lazy attribute causes that fields containing "" or 0 are not added and not written
federated.service.solr.indexing.lazy = true
# the indexing engine in YaCy can be switched off or on
# (off may make sense if federated.service.solr.indexing.enabled = true)

@ -64,7 +64,7 @@ public class AccessPicture_p {
color_grid = post.get("colorgrid", color_grid);
color_dot = post.get("colordot", color_dot);
color_line = post.get("colorline", color_line);
corona = post.getBoolean("corona", true);
corona = !post.containsKey("corona") || post.getBoolean("corona");
coronaangle = (corona) ? post.getInt("coronaangle", 0) : -1;
}
if (coronaangle < 0) corona = false;

@ -77,29 +77,29 @@ public class ConfigPortal {
sb.setConfig(SwitchboardConstants.SEARCH_ITEMS, post.getInt("maximumRecords", 10));
sb.setConfig(SwitchboardConstants.INDEX_FORWARD, post.get(SwitchboardConstants.INDEX_FORWARD, ""));
HTTPDFileHandler.indexForward = post.get(SwitchboardConstants.INDEX_FORWARD, "");
sb.setConfig("publicTopmenu", post.getBoolean("publicTopmenu", true));
sb.setConfig("publicSearchpage", post.getBoolean("publicSearchpage", true));
sb.setConfig("search.options", post.getBoolean("search.options", false));
sb.setConfig("interaction.userlogon.enabled", post.getBoolean("interaction.userlogon", false));
sb.setConfig("search.text", post.getBoolean("search.text", false));
sb.setConfig("search.image", post.getBoolean("search.image", false));
sb.setConfig("search.audio", post.getBoolean("search.audio", false));
sb.setConfig("search.video", post.getBoolean("search.video", false));
sb.setConfig("search.app", post.getBoolean("search.app", false));
sb.setConfig("search.result.show.date", post.getBoolean("search.result.show.date", false));
sb.setConfig("search.result.show.size", post.getBoolean("search.result.show.size", false));
sb.setConfig("search.result.show.metadata", post.getBoolean("search.result.show.metadata", false));
sb.setConfig("search.result.show.parser", post.getBoolean("search.result.show.parser", false));
sb.setConfig("search.result.show.pictures", post.getBoolean("search.result.show.pictures", false));
sb.setConfig("search.result.show.cache", post.getBoolean("search.result.show.cache", false));
sb.setConfig("search.result.show.proxy", post.getBoolean("search.result.show.proxy", false));
sb.setConfig("search.result.show.tags", post.getBoolean("search.result.show.tags", false));
sb.setConfig("publicTopmenu", !post.containsKey("publicTopmenu") || post.getBoolean("publicTopmenu"));
sb.setConfig("publicSearchpage", !post.containsKey("publicSearchpage") || post.getBoolean("publicSearchpage"));
sb.setConfig("search.options", post.getBoolean("search.options"));
sb.setConfig("interaction.userlogon.enabled", post.getBoolean("interaction.userlogon"));
sb.setConfig("search.text", post.getBoolean("search.text"));
sb.setConfig("search.image", post.getBoolean("search.image"));
sb.setConfig("search.audio", post.getBoolean("search.audio"));
sb.setConfig("search.video", post.getBoolean("search.video"));
sb.setConfig("search.app", post.getBoolean("search.app"));
sb.setConfig("search.result.show.date", post.getBoolean("search.result.show.date"));
sb.setConfig("search.result.show.size", post.getBoolean("search.result.show.size"));
sb.setConfig("search.result.show.metadata", post.getBoolean("search.result.show.metadata"));
sb.setConfig("search.result.show.parser", post.getBoolean("search.result.show.parser"));
sb.setConfig("search.result.show.pictures", post.getBoolean("search.result.show.pictures"));
sb.setConfig("search.result.show.cache", post.getBoolean("search.result.show.cache"));
sb.setConfig("search.result.show.proxy", post.getBoolean("search.result.show.proxy"));
sb.setConfig("search.result.show.tags", post.getBoolean("search.result.show.tags"));
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY, post.get("search.verify", "ifexist"));
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY_DELETE, post.getBoolean("search.verify.delete", false));
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY_DELETE, post.getBoolean("search.verify.delete"));
sb.setConfig("about.headline", post.get("about.headline", ""));
sb.setConfig("about.body", post.get("about.body", ""));
@ -110,10 +110,10 @@ public class ConfigPortal {
// construct navigation String
String nav = "";
if (post.getBoolean("search.navigation.hosts", false)) nav += "hosts,";
if (post.getBoolean("search.navigation.authors", false)) nav += "authors,";
if (post.getBoolean("search.navigation.namespace", false)) nav += "namespace,";
if (post.getBoolean("search.navigation.topics", false)) nav += "topics,";
if (post.getBoolean("search.navigation.hosts")) nav += "hosts,";
if (post.getBoolean("search.navigation.authors")) nav += "authors,";
if (post.getBoolean("search.navigation.namespace")) nav += "namespace,";
if (post.getBoolean("search.navigation.topics")) nav += "topics,";
if (nav.endsWith(",")) nav = nav.substring(0, nav.length() - 1); sb.setConfig("search.navigation", nav);
}
if (post.containsKey("searchpage_default")) {
@ -164,7 +164,7 @@ public class ConfigPortal {
prop.put("search.options", sb.getConfigBool("search.options", false) ? 1 : 0);
prop.put("interaction.userlogon", sb.getConfigBool("interaction.userlogon.enabled", false) ? 1 : 0);
prop.put("search.text", sb.getConfigBool("search.text", false) ? 1 : 0);
prop.put("search.image", sb.getConfigBool("search.image", false) ? 1 : 0);
prop.put("search.audio", sb.getConfigBool("search.audio", false) ? 1 : 0);

@ -149,7 +149,7 @@ public class ConfigUpdate_p {
sb.setConfig("update.cycle", Math.max(12, post.getLong("cycle", 168)));
sb.setConfig("update.blacklist", post.get("blacklist", ""));
sb.setConfig("update.concept", ("any".equals(post.get("releaseType", "any"))) ? "any" : "main");
sb.setConfig("update.onlySignedFiles", (post.getBoolean("onlySignedFiles", false)) ? "1" : "0");
sb.setConfig("update.onlySignedFiles", (post.getBoolean("onlySignedFiles")) ? "1" : "0");
}
}

@ -30,6 +30,9 @@
import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.net.URLEncoder;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import net.yacy.cora.protocol.ConnectionInfo;
@ -43,12 +46,9 @@ import de.anomic.server.serverCore;
import de.anomic.server.serverCore.Session;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
public final class Connections_p {
public final class Connections_p {
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
final Switchboard sb = (Switchboard) env;
@ -57,44 +57,44 @@ public final class Connections_p {
// server sessions
// get the serverCore thread
final WorkflowThread httpd = sb.getThread("10_httpd");
// determines if name lookup should be done or not
// determines if name lookup should be done or not
final boolean doNameLookup;
if (post != null) {
doNameLookup = (post.containsKey("nameLookup") && post.getBoolean("nameLookup", true));
if (post != null) {
doNameLookup = post.getBoolean("nameLookup");
if (post.containsKey("closeServerSession")) {
final String sessionName = post.get("closeServerSession", null);
sb.closeSessions("10_httpd", sessionName);
prop.put("LOCATION","");
return prop;
return prop;
}
} else {
doNameLookup = false;
}
// waiting for all threads to finish
int idx = 0, numActiveRunning = 0, numActivePending = 0;
boolean dark = true;
for (final Session s: ((serverCore) httpd).getJobList()) {
if (!s.isAlive()) continue;
// get the session runtime
final long sessionTime = s.getTime();
// get the request command line
String commandLine = s.getCommandLine();
final boolean blockingRequest = (commandLine == null);
final int commandCount = s.getCommandCount();
// get the source ip address and port
final InetAddress userAddress = s.getUserAddress();
final int userPort = s.getUserPort();
if (userAddress == null) {
continue;
}
String prot = "http"; // only httpd sessions listed
// determining if the source is a yacy host
Seed seed = null;
if (doNameLookup) {
@ -104,7 +104,7 @@ public final class Connections_p {
seed = null;
}
}
prop.put("list_" + idx + "_dark", dark ? "1" : "0");
dark = !dark;
try {
@ -135,20 +135,20 @@ public final class Connections_p {
}
prop.putNum("list_" + idx + "_used", commandCount);
idx++;
}
}
prop.put("list", idx);
prop.putNum("numMax", ((serverCore)httpd).getMaxSessionCount());
prop.putNum("numActiveRunning", numActiveRunning);
prop.putNum("numActivePending", numActivePending);
// client sessions
final Set<ConnectionInfo> allConnections = ConnectionInfo.getAllConnections();
// sorting: sort by initTime, decending
List<ConnectionInfo> allConnectionsSorted = new LinkedList<ConnectionInfo>(allConnections);
Collections.sort(allConnectionsSorted);
Collections.reverse(allConnectionsSorted); // toggle ascending/descending
int c = 0;
synchronized (allConnectionsSorted) {
for (final ConnectionInfo conInfo: allConnectionsSorted) {
@ -163,7 +163,7 @@ public final class Connections_p {
}
prop.put("clientList", c);
prop.put("clientActive", ConnectionInfo.getCount());
// return rewrite values for templates
return prop;
}

@ -182,7 +182,7 @@ public class Crawler_p {
String ipMustMatch = post.get("ipMustmatch", CrawlProfile.MATCH_ALL_STRING);
final String ipMustNotMatch = post.get("ipMustnotmatch", CrawlProfile.MATCH_NEVER_STRING);
if (ipMustMatch.length() < 2) ipMustMatch = CrawlProfile.MATCH_ALL_STRING;
final String countryMustMatch = post.getBoolean("countryMustMatchSwitch", false) ? post.get("countryMustMatchList", "") : "";
final String countryMustMatch = post.getBoolean("countryMustMatchSwitch") ? post.get("countryMustMatchList", "") : "";
sb.setConfig("crawlingIPMustMatch", ipMustMatch);
sb.setConfig("crawlingIPMustNotMatch", ipMustNotMatch);
if (countryMustMatch.length() > 0) sb.setConfig("crawlingCountryMustMatch", countryMustMatch);

@ -36,7 +36,6 @@
<input type="checkbox" name="solr.indexing.solrremote" id="solr.indexing.solrremote" #(solr.indexing.solrremote.checked)#:: checked="checked"#(/solr.indexing.solrremote.checked)# />
<label for="p2p">Remote Solr Search Index</label>
</legend>
You can set one or more Solr targets here. If you wish to set several targets, then list them in the 'Solr URL' field using a ',' (comma) as separator.
<div align="left">
<dl>
@ -60,13 +59,17 @@
</dd>
#(/table)#
<dt class="TableCellDark">Solr URL(s)</dt>
<dd><textarea rows="5" cols="80" name="solr.indexing.url" id="solr.indexing.url"/>#[solr.indexing.url]#</textarea></dd>
<dd><textarea rows="2" cols="80" name="solr.indexing.url" id="solr.indexing.url"/>#[solr.indexing.url]#</textarea><br/>
You can set one or more Solr targets here which are accessed as a shard. For several targets, list them using a ',' (comma) as separator.</dd>
<dt class="TableCellDark">Commit-Within (milliseconds)</dt>
<dd><input type="text" size="6" maxlength="6" value="#[solr.indexing.commitWithinMs]#" name="solr.indexing.commitWithinMs" id="solr.indexing.commitWithinMs"/></dd>
<dd><input type="text" size="6" maxlength="6" value="#[solr.indexing.commitWithinMs]#" name="solr.indexing.commitWithinMs" id="solr.indexing.commitWithinMs"/> (increase this value to i.e. 180000 - 3 minutes - for more performance)</dd>
<dt class="TableCellDark">Lazy Value Initialization</dt>
<dd><input type="checkbox" name="solr.indexing.lazy" id="solr.indexing.lazy" #(solr.indexing.lazy.checked)#:: checked="checked"#(/solr.indexing.lazy.checked)# /> (if checked, only non-zero values and non-empty strings are written)</dd>
<dt class="TableCellDark">Sharding Method</dt>
<dd><input type="text" size="50" maxlength="50" value="#[solr.indexing.sharding]#" name="solr.indexing.sharding" id="solr.indexing.sharding" disabled="disabled"/></dd>
<dt class="TableCellDark">Scheme</dt>
<dd><input type="text" size="50" maxlength="50" value="#[solr.indexing.schemefile]#" name="solr.indexing.schemefile" id="solr.indexing.schemefile" disabled="disabled"/></dd>
<dt></dt><dd><input type="submit" name="set" value="Set" /></dd>
</dl>
</div>
<div>

@ -56,10 +56,11 @@ public class IndexFederated_p {
// solr
final boolean solrWasOn = env.getConfigBool("federated.service.solr.indexing.enabled", true);
final boolean solrIsOnAfterwards = post.getBoolean("solr.indexing.solrremote", false);
final boolean solrIsOnAfterwards = post.getBoolean("solr.indexing.solrremote");
env.setConfig("federated.service.solr.indexing.enabled", solrIsOnAfterwards);
String solrurls = post.get("solr.indexing.url", env.getConfig("federated.service.solr.indexing.url", "http://127.0.0.1:8983/solr"));
int commitWithinMs = post.getInt("solr.indexing.commitWithinMs", env.getConfigInt("federated.service.solr.indexing.commitWithinMs", 180000));
boolean lazy = post.getBoolean("solr.indexing.lazy");
final BufferedReader r = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(UTF8.getBytes(solrurls))));
final StringBuilder s = new StringBuilder();
String s0;
@ -78,6 +79,7 @@ public class IndexFederated_p {
solrurls = s.toString().trim();
env.setConfig("federated.service.solr.indexing.url", solrurls);
env.setConfig("federated.service.solr.indexing.commitWithinMs", commitWithinMs);
env.setConfig("federated.service.solr.indexing.lazy", lazy);
env.setConfig("federated.service.solr.indexing.sharding", post.get("solr.indexing.sharding", env.getConfig("federated.service.solr.indexing.sharding", "modulo-host-md5")));
final String schemename = post.get("solr.indexing.schemefile", env.getConfig("federated.service.solr.indexing.schemefile", "solr.keys.default.list"));
env.setConfig("federated.service.solr.indexing.schemefile", schemename);
@ -188,6 +190,7 @@ public class IndexFederated_p {
prop.put("solr.indexing.solrremote.checked", env.getConfigBool("federated.service.solr.indexing.enabled", false) ? 1 : 0);
prop.put("solr.indexing.url", env.getConfig("federated.service.solr.indexing.url", "http://127.0.0.1:8983/solr").replace(",", "\n"));
prop.put("solr.indexing.commitWithinMs", env.getConfigInt("federated.service.solr.indexing.commitWithinMs", 180000));
prop.put("solr.indexing.lazy.checked", env.getConfigBool("federated.service.solr.indexing.lazy", true) ? 1 : 0);
prop.put("solr.indexing.sharding", env.getConfig("federated.service.solr.indexing.sharding", "modulo-host-md5"));
prop.put("solr.indexing.schemefile", schemename);

@ -90,7 +90,7 @@ public class NetworkPicture
passiveLimit = post.getInt("pal", passiveLimit);
potentialLimit = post.getInt("pol", potentialLimit);
maxCount = post.getInt("max", maxCount);
corona = post.getBoolean("corona", true);
corona = !post.containsKey("corona") || post.getBoolean("corona");
coronaangle = (corona) ? post.getInt("coronaangle", 0) : -1;
communicationTimeout = post.getLong("ct", -1);
bgcolor = post.get("bgcolor", bgcolor);

@ -8,47 +8,46 @@ import net.yacy.kelondro.workflow.BusyThread;
import net.yacy.peers.graphics.NetworkGraph;
import net.yacy.peers.graphics.NetworkGraph.CircleThreadPiece;
import net.yacy.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class PeerLoadPicture {
public static Image respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
int width = 800;
int height = 600;
boolean showidle = true;
if (post != null) {
width = post.getInt("width", 800);
height = post.getInt("height", 600);
showidle = post.getBoolean("showidle", true);
showidle = post.getBoolean("showidle");
}
final CircleThreadPiece idle = new CircleThreadPiece("Idle", new Color(170, 255, 170));
final CircleThreadPiece misc = new CircleThreadPiece("Misc.", new Color(190, 50, 180));
final HashMap<String, CircleThreadPiece> pieces = new HashMap<String, CircleThreadPiece>();
pieces.put(null, idle);
pieces.put(SwitchboardConstants.INDEX_DIST, new CircleThreadPiece("DHT-Distribution", new Color(119, 136, 153)));
pieces.put(SwitchboardConstants.PEER_PING, new CircleThreadPiece("YaCy Core", new Color(255, 230, 160)));
final Iterator<String> threads = env.threadNames();
String threadname;
BusyThread thread;
long busy_time = 0;
//Iterate over threads
while (threads.hasNext()) {
threadname = threads.next();
thread = env.getThread(threadname);
//count total times
busy_time += thread.getBlockTime();
busy_time += thread.getExecTime();
if (showidle) idle.addExecTime(thread.getSleepTime());
//count threadgroup-specific times
final CircleThreadPiece piece = pieces.get(threadname);
if (piece == null) {
@ -58,7 +57,7 @@ public class PeerLoadPicture {
}
}
busy_time += idle.getExecTime();
// set respective angles
final Iterator<CircleThreadPiece> it = pieces.values().iterator();
CircleThreadPiece current;
@ -69,7 +68,7 @@ public class PeerLoadPicture {
if(current.getAngle() == 0) it.remove();
}
misc.setFraction(busy_time);
// too small values lead to an error, too big to huge CPU/memory consumption,
// resulting in possible DOS.
if (width < 40) width = 40;

@ -101,11 +101,11 @@ public class Status
ByteCount.resetCount();
redirect = true;
} else if ( post.containsKey("popup") ) {
final boolean trigger_enabled = post.getBoolean("popup", false);
final boolean trigger_enabled = post.getBoolean("popup");
sb.setConfig("browserPopUpTrigger", trigger_enabled);
redirect = true;
} else if ( post.containsKey("tray") ) {
final boolean trigger_enabled = post.getBoolean("tray", false);
final boolean trigger_enabled = post.getBoolean("tray");
sb.setConfig("trayIcon", trigger_enabled);
redirect = true;
}

@ -64,7 +64,7 @@ public class Table_API_p {
startRecord = 0;
maximumRecords = 1000;
}
final boolean inline = (post != null && post.getBoolean("inline", false));
final boolean inline = (post != null && post.getBoolean("inline"));
prop.put("inline", (inline) ? 1 : 0);

@ -1,4 +1,4 @@
// Threaddump_p.java
// Threaddump_p.java
// -----------------------
// part of YACY
// (C) by Michael Peter Christen; mc@yacy.net
@ -28,29 +28,28 @@
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.Map;
import java.util.ArrayList;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.logging.ThreadDump;
import net.yacy.kelondro.util.OS;
import net.yacy.peers.operation.yacyBuildProperties;
import net.yacy.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class Threaddump_p {
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
serverObjects prop = new serverObjects();
Switchboard sb = (Switchboard) env;
final StringBuilder buffer = new StringBuilder(1000);
final boolean plain = post != null && post.getBoolean("plain", false);
final boolean plain = post != null && post.getBoolean("plain");
final int sleep = (post == null) ? 0 : post.getInt("sleep", 0); // a sleep before creation of a thread dump can be used for profiling
if (sleep > 0) try {Thread.sleep(sleep);} catch (final InterruptedException e) {}
prop.put("dump", "1");
@ -58,7 +57,7 @@ public class Threaddump_p {
final Date dt = new Date();
final String versionstring = yacyBuildProperties.getVersion() + "/" + yacyBuildProperties.getSVNRevision();
Runtime runtime = Runtime.getRuntime();
ThreadDump.bufferappend(buffer, plain, "************* Start Thread Dump " + dt + " *******************");
ThreadDump.bufferappend(buffer, plain, "");
ThreadDump.bufferappend(buffer, plain, "YaCy Version: " + versionstring);
@ -67,7 +66,7 @@ public class Threaddump_p {
ThreadDump.bufferappend(buffer, plain, "Available&nbsp;&nbsp;Memory = " + (runtime.maxMemory() - runtime.totalMemory() + runtime.freeMemory()));
ThreadDump.bufferappend(buffer, plain, "");
ThreadDump.bufferappend(buffer, plain, "");
int multipleCount = 100;
File appPath = sb.getAppPath();
if (post != null && post.containsKey("multipleThreaddump")) {
@ -94,7 +93,7 @@ public class Threaddump_p {
ThreadDump.bufferappend(buffer, plain, "this thread dump function can find threads that lock others, to enable this function start YaCy with 'startYACY.sh -l'");
ThreadDump.bufferappend(buffer, plain, "");
}
// generate a single thread dump
final Map<Thread,StackTraceElement[]> stackTraces = ThreadDump.getAllStackTraces();
new ThreadDump(appPath, stackTraces, plain, Thread.State.BLOCKED).appendStackTraces(buffer, plain, Thread.State.BLOCKED);
@ -104,16 +103,16 @@ public class Threaddump_p {
new ThreadDump(appPath, stackTraces, plain, Thread.State.NEW).appendStackTraces(buffer, plain, Thread.State.NEW);
new ThreadDump(appPath, stackTraces, plain, Thread.State.TERMINATED).appendStackTraces(buffer, plain, Thread.State.TERMINATED);
}
ThreadDump.bufferappend(buffer, plain, "************* End Thread Dump " + dt + " *******************");
prop.put("plain_count", multipleCount);
prop.put("plain_content", buffer.toString());
prop.put("plain", (plain) ? 1 : 0);
return prop; // return from serverObjects respond()
}
}
}

@ -151,7 +151,7 @@ public class ViewFile {
// define an url by post parameter
url = new DigestURI(MultiProtocolURI.unescape(urlString));
urlHash = ASCII.String(url.hash());
pre = post.getBoolean("pre", false);
pre = post.getBoolean("pre");
} catch (final MalformedURLException e) {}

@ -61,7 +61,7 @@ public class import_ymark {
boolean merge = false;
boolean empty = false;
final String indexing = post.get("indexing", "off");
final boolean medialink = post.getBoolean("medialink", false);
final boolean medialink = post.getBoolean("medialink");
if(post.containsKey("autotag") && !post.get("autotag", "off").equals("off")) {
autotag = true;

@ -44,7 +44,7 @@ public class opensearchdescription {
if (thisaddress.indexOf(':',0) == -1) thisaddress += ":" + serverCore.getPortNr(env.getConfig("port", "8090"));
int compareyacy = 0;
if (post != null && post.getBoolean("compare_yacy", false))
if (post != null && post.getBoolean("compare_yacy"))
compareyacy = 1;
final serverObjects prop = new serverObjects();

@ -373,9 +373,9 @@ public class serverObjects extends HashMap<String, String> implements Cloneable
}
}
public boolean getBoolean(final String key, final boolean dflt) {
public boolean getBoolean(final String key) {
String s = removeByteOrderMark(super.get(key));
if (s == null) return dflt;
if (s == null) return false;
s = s.toLowerCase();
return s.equals("true") || s.equals("on") || s.equals("1");
}

@ -398,8 +398,9 @@ public final class Switchboard extends serverSwitch
if ( !solrWorkProfile.exists() ) {
Files.copy(solrBackupProfile, solrWorkProfile);
}
final SolrConfiguration backupScheme = new SolrConfiguration(solrBackupProfile);
this.solrScheme = new SolrConfiguration(solrWorkProfile);
final boolean solrlazy = getConfigBool("federated.service.solr.indexing.lazy", true);
final SolrConfiguration backupScheme = new SolrConfiguration(solrBackupProfile, solrlazy);
this.solrScheme = new SolrConfiguration(solrWorkProfile, solrlazy);
// update the working scheme with the backup scheme. This is necessary to include new features.
// new features are always activated by default (if activated in input-backupScheme)

@ -58,12 +58,15 @@ public class SolrConfiguration extends ConfigurationSet implements Serializable
private static final long serialVersionUID=-499100932212840385L;
private boolean lazy;
/**
* initialize with an empty ConfigurationSet which will cause that all the index
* attributes are used
*/
public SolrConfiguration() {
super();
this.lazy = false;
}
/**
@ -72,7 +75,7 @@ public class SolrConfiguration extends ConfigurationSet implements Serializable
* or keyword = value lines (while value is a custom Solr field name
* @param configurationFile
*/
public SolrConfiguration(final File configurationFile) {
public SolrConfiguration(final File configurationFile, boolean lazy) {
super(configurationFile);
// check consistency: compare with YaCyField enum
if (this.isEmpty()) return;
@ -86,22 +89,27 @@ public class SolrConfiguration extends ConfigurationSet implements Serializable
it.remove();
}
}
this.lazy = lazy;
}
protected void addSolr(final SolrDoc solrdoc, final SolrField key, final String value) {
if (isEmpty() || contains(key.name())) solrdoc.addSolr(key, value);
if ((isEmpty() || contains(key.name())) && (!this.lazy || (value != null && value.length() > 0))) solrdoc.addSolr(key, value);
}
protected void addSolr(final SolrDoc solrdoc, final SolrField key, final Date value) {
if (isEmpty() || contains(key.name())) solrdoc.addSolr(key, value);
protected void addSolr(final SolrDoc solrdoc, final SolrField key, final String value, final float boost) {
if ((isEmpty() || contains(key.name())) && (!this.lazy || (value != null && value.length() > 0))) solrdoc.addSolr(key, value, boost);
}
protected void addSolr(final SolrDoc solrdoc, final SolrField key, final int value) {
if (isEmpty() || contains(key.name())) solrdoc.addSolr(key, value);
protected void addSolr(final SolrDoc solrdoc, final SolrField key, final Date value) {
if ((isEmpty() || contains(key.name())) && (!this.lazy || (value != null && value.getTime() > 0))) solrdoc.addSolr(key, value);
}
protected void addSolr(final SolrDoc solrdoc, final SolrField key, final String[] value) {
if (isEmpty() || contains(key.name())) solrdoc.addSolr(key, value);
if ((isEmpty() || contains(key.name())) && (!this.lazy || (value != null && value.length > 0))) solrdoc.addSolr(key, value);
}
protected void addSolr(final SolrDoc solrdoc, final SolrField key, final int value) {
if ((isEmpty() || contains(key.name())) && (!this.lazy || value > 0)) solrdoc.addSolr(key, value);
}
protected void addSolr(final SolrDoc solrdoc, final SolrField key, final float value) {
@ -116,10 +124,6 @@ public class SolrConfiguration extends ConfigurationSet implements Serializable
if (isEmpty() || contains(key.name())) solrdoc.addSolr(key, value);
}
protected void addSolr(final SolrDoc solrdoc, final SolrField key, final String value, final float boost) {
if (isEmpty() || contains(key.name())) solrdoc.addSolr(key, value, boost);
}
/**
* save configuration to file and update enum SolrFields

Loading…
Cancel
Save