|
|
|
@ -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 order
|
|
|
|
|