diff --git a/htroot/IndexSchema_p.html b/htroot/IndexSchema_p.html index cb8d35641..9b80ab0b3 100644 --- a/htroot/IndexSchema_p.html +++ b/htroot/IndexSchema_p.html @@ -47,7 +47,10 @@ - +
+ + +
#%env/templates/footer.template%# diff --git a/htroot/IndexSchema_p.java b/htroot/IndexSchema_p.java index 388928d7b..3a0f133e5 100644 --- a/htroot/IndexSchema_p.java +++ b/htroot/IndexSchema_p.java @@ -18,14 +18,17 @@ * If not, see . */ +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 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 order diff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.java index 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 slots public static int xstackCrawlSlots = 2000;