Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
add: reset Solr schema filed selection to default button in IndexSchema_p
regerd57b221921df
diff --git a/htroot/IndexSchema_p.html b/htroot/IndexSchema_p.htmlindex cb8d35641..9b80ab0b3 100644--- a/htroot/IndexSchema_p.html+++ b/htroot/IndexSchema_p.html@@ -47,7 +47,10 @@</table></div></fieldset>- <input type="submit" name="set" value="Set" />+ <div>+ <input type="submit" name="set" value="Set" />+ <input style="float:right" type="submit" name="resetselectiontodefault" value="reset selection to default" />+ </div></form>#%env/templates/footer.template%#diff --git a/htroot/IndexSchema_p.java b/htroot/IndexSchema_p.javaindex 388928d7b..3a0f133e5 100644--- a/htroot/IndexSchema_p.java+++ b/htroot/IndexSchema_p.java@@ -18,14 +18,17 @@* If not, see <http://www.gnu.org/licenses/>.*/+import java.io.File;import java.io.IOException;import java.util.Iterator;import net.yacy.cora.federate.solr.SchemaConfiguration;import net.yacy.cora.federate.solr.SchemaDeclaration;import net.yacy.cora.protocol.RequestHeader;+import net.yacy.kelondro.logging.Log;import net.yacy.search.Switchboard;import net.yacy.search.schema.CollectionSchema;+import net.yacy.search.schema.WebgraphConfiguration;import net.yacy.search.schema.WebgraphSchema;import net.yacy.server.serverObjects;import net.yacy.server.serverSwitch;@@ -73,7 +76,28 @@ public class IndexSchema_p {} catch (IOException ex) {}}}-++ if (post != null && post.containsKey("resetselectiontodefault")) {+ // reset Solr field selection to default configuration+ File solrInitFile;+ if (cs instanceof WebgraphConfiguration) { // get default configuration for webgraph+ solrInitFile = new File(sb.getAppPath(), "defaults/" + Switchboard.SOLR_WEBGRAPH_CONFIGURATION_NAME);+ } else { // or get default configuration for collection1+ solrInitFile = new File(sb.getAppPath(), "defaults/" + Switchboard.SOLR_COLLECTION_CONFIGURATION_NAME);+ }+ try {+ SchemaConfiguration solrConfigurationInit = new SchemaConfiguration(solrInitFile);+ Iterator<SchemaConfiguration.Entry> it = cs.entryIterator(); // get current configuration+ while (it.hasNext()) { // iterate over entries and enable/disable according to default+ SchemaConfiguration.Entry etr = it.next();+ etr.setEnable(solrConfigurationInit.contains(etr.key()));+ }+ cs.commit();+ } catch (IOException ex) {+ Log.logWarning("IndexSchema", "file " + solrInitFile.getAbsolutePath() + " not found");+ }+ }+int c = 0;boolean dark = false;// use enum SolrField to keep defined orderdiff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.javaindex eb069eac2..53d03f716 100644--- a/source/net/yacy/search/Switchboard.java+++ b/source/net/yacy/search/Switchboard.java@@ -206,8 +206,8 @@ import com.google.common.io.Files;public final class Switchboard extends serverSwitch {final static String SOLR_COLLECTION_CONFIGURATION_NAME_OLD = "solr.keys.default.list";- final static String SOLR_COLLECTION_CONFIGURATION_NAME = "solr.collection.schema";- final static String SOLR_WEBGRAPH_CONFIGURATION_NAME = "solr.webgraph.schema";+ public final static String SOLR_COLLECTION_CONFIGURATION_NAME = "solr.collection.schema";+ public final static String SOLR_WEBGRAPH_CONFIGURATION_NAME = "solr.webgraph.schema";// load slotspublic static int xstackCrawlSlots = 2000;