Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

added serialization

Michael Peter Christen5deebd02ea07
diff --git a/htroot/IndexFederated_p.html b/htroot/IndexFederated_p.html
index 00342e738..132c1865a 100644
--- a/htroot/IndexFederated_p.html
+++ b/htroot/IndexFederated_p.html
@@ -14,7 +14,7 @@
#%env/templates/submenuIndexControl.template%#
<h2>Federated Index</h2>
<p>
- YaCy supports multiple index storage locations. At this time only the YaCy-internal search index can be used for the Yacy search interface
+ YaCy supports multiple index storage locations. At this time only the YaCy-internal search index can be used for the YaCy search interface
A Solr index storage location is optional. The local index storage location can be disabled.
</p>
@@ -65,12 +65,12 @@
</dl>
</div>
<div>
- <h3>Index Scheme</h3><p>If you use a custom Solr schema you may enter a different field name in the column 'cutom Solr Field Name' of the YacY default attribute name</p>
+ <h3>Index Scheme</h3><p>If you use a custom Solr schema you may enter a different field name in the column 'cutom Solr Field Name' of the YaCy default attribute name</p>
<table class="sortable" border="0" cellpadding="2" cellspacing="1">
<tr class="TableHeader" valign="bottom">
<td>Active</td>
<td>Attribute</td>
- <td>custom Solr Field Name</td>
+ <td>Custom Solr Field Name</td>
<td>Comment</td>
</tr>
#{scheme}#
diff --git a/source/net/yacy/cora/storage/ConfigurationSet.java b/source/net/yacy/cora/storage/ConfigurationSet.java
index fd6c02216..99fe6de16 100644
--- a/source/net/yacy/cora/storage/ConfigurationSet.java
+++ b/source/net/yacy/cora/storage/ConfigurationSet.java
@@ -30,11 +30,14 @@ import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
-import java.util.*;
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;
-import net.yacy.kelondro.util.FileUtils;
+
import net.yacy.cora.storage.ConfigurationSet.Entry;
+import net.yacy.kelondro.util.FileUtils;
import net.yacy.search.index.SolrField;
/**
* this class reads configuration attributes as a list of keywords from a list
@@ -49,8 +52,10 @@ import net.yacy.search.index.SolrField;
* - a line may contain a key only or a key=value pair
* @author Michael Christen
*/
-public class ConfigurationSet extends TreeMap<String,Entry> {
- private static final long serialVersionUID = 1L;
+public class ConfigurationSet extends TreeMap<String,Entry> implements Serializable {
+
+ private static final long serialVersionUID=-5961730809008841258L;
+
private final File file;
public ConfigurationSet() {
@@ -103,7 +108,7 @@ public class ConfigurationSet extends TreeMap<String,Entry> {
entry.setComment(comment);
comment = null;
}
- this.put(key, entry);
+ this.put(key, entry);
}
}
}
@@ -192,7 +197,7 @@ public class ConfigurationSet extends TreeMap<String,Entry> {
public void commit() throws IOException {
if (this.file == null) return;
// create a temporary bak file, use it as template to preserve user comments
- File bakfile = new File (file.getAbsolutePath() + ".bak");
+ File bakfile = new File (this.file.getAbsolutePath() + ".bak");
FileUtils.copy (this.file, bakfile);
TreeMap tclone = (TreeMap) this.clone(); // clone to write appended entries
@@ -219,7 +224,7 @@ public class ConfigurationSet extends TreeMap<String,Entry> {
// second # = is a line comment
i = s.indexOf("#");
s = s.substring(0,i).trim();
- }
+ }
if (s.contains("=")) {
i = s.indexOf("=");
key = s.substring(0,i).trim();
@@ -232,7 +237,7 @@ public class ConfigurationSet extends TreeMap<String,Entry> {
writer.write (e.toString());
tclone.remove(key); // remove written entries from clone
} else {writer.write(sorig); }
- writer.write("\n");
+ writer.write("\n");
} else {
writer.write(sorig+"\n");
}
@@ -241,7 +246,7 @@ public class ConfigurationSet extends TreeMap<String,Entry> {
reader.close();
bakfile.delete();
} catch (final IOException e) {}
-
+
// write remainig entries (not already written)
Iterator ie = tclone.entrySet().iterator();
while (ie.hasNext()) {
diff --git a/source/net/yacy/search/index/SolrConfiguration.java b/source/net/yacy/search/index/SolrConfiguration.java
index 739938e34..563684aaa 100644
--- a/source/net/yacy/search/index/SolrConfiguration.java
+++ b/source/net/yacy/search/index/SolrConfiguration.java
@@ -27,9 +27,17 @@ package net.yacy.search.index;
import java.io.File;
import java.io.IOException;
+import java.io.Serializable;
import java.net.InetAddress;
import java.net.MalformedURLException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.MultiProtocolURI;
@@ -46,7 +54,9 @@ import net.yacy.kelondro.logging.Log;
import org.apache.solr.common.SolrDocument;
-public class SolrConfiguration extends ConfigurationSet {
+public class SolrConfiguration extends ConfigurationSet implements Serializable {
+
+ private static final long serialVersionUID=-499100932212840385L;
/**
* initialize with an empty ConfigurationSet which will cause that all the index