Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
Add consistency check for related index fields upon load and save of index schema. To assemble the original link url for out-/inboundlinks, icons and pictures the *_protocol_sxt and *_urlstub_sxt is needed (due to the used data-reduced storage methode). Auto-enable *_protocol_sxt if *_urlstub_sxt is enabled. to be able to correctly assemble the original link url.
reger1f497ccad54d
diff --git a/source/net/yacy/search/schema/CollectionConfiguration.java b/source/net/yacy/search/schema/CollectionConfiguration.javaindex 93074d9b0..7bc87e09e 100644--- a/source/net/yacy/search/schema/CollectionConfiguration.java+++ b/source/net/yacy/search/schema/CollectionConfiguration.java@@ -150,6 +150,38 @@ public class CollectionConfiguration extends SchemaConfiguration implements SeriConcurrentLog.warn("SolrCollectionWriter", " solr schema file " + configurationFile.getAbsolutePath() + " is missing declaration for '" + field.name() + "'");}}+ checkFieldRelationConsistency();+ }++ /**+ * Check and update schema configuration with required related fields.+ * If a specific field is enabled, there might be a other field internal+ * processes rely on. Enable these required fields.+ * For example, the outboundlinks are split into protocol and url part. The+ * correct original url can only be assembled if both fields are available (protocol + url = originalUrl)+ */+ private void checkFieldRelationConsistency() {+ Entry e;+ // for correct assembly of outboundlinks outboundlinks_protocol_sxt + outboundlinks_urlstub_sxt is needed+ if (this.contains(CollectionSchema.outboundlinks_urlstub_sxt) && !this.contains(CollectionSchema.outboundlinks_protocol_sxt)) {+ e = new Entry(CollectionSchema.outboundlinks_protocol_sxt.name(), CollectionSchema.outboundlinks_protocol_sxt.getSolrFieldName(), true);+ this.put(CollectionSchema.outboundlinks_protocol_sxt.name(), e);+ }+ // for correct assembly of inboundlinks inboundlinks_protocol_sxt + inboundlinks_urlstub_sxt is needed+ if (this.contains(CollectionSchema.inboundlinks_urlstub_sxt) && !this.contains(CollectionSchema.inboundlinks_protocol_sxt)) {+ e = new Entry(CollectionSchema.inboundlinks_protocol_sxt.name(), CollectionSchema.inboundlinks_protocol_sxt.getSolrFieldName(), true);+ this.put(CollectionSchema.inboundlinks_protocol_sxt.name(), e);+ }+ // for correct assembly of icon url icons_protocol_sxt + icons_urlstub_sxt is needed+ if (this.contains(CollectionSchema.icons_urlstub_sxt) && !this.contains(CollectionSchema.icons_protocol_sxt)) {+ e = new Entry(CollectionSchema.icons_protocol_sxt.name(), CollectionSchema.icons_protocol_sxt.getSolrFieldName(), true);+ this.put(CollectionSchema.icons_protocol_sxt.name(), e);+ }+ // for correct assembly of image url images_protocol_sxt + images_urlstub_sxt is needed+ if (this.contains(CollectionSchema.images_urlstub_sxt) && !this.contains(CollectionSchema.images_protocol_sxt)) {+ e = new Entry(CollectionSchema.images_protocol_sxt.name(), CollectionSchema.images_protocol_sxt.getSolrFieldName(), true);+ this.put(CollectionSchema.images_protocol_sxt.name(), e);+ }}public String[] allFields() {@@ -183,6 +215,7 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri*/@Overridepublic void commit() throws IOException {+ checkFieldRelationConsistency(); // in case of changes, check related fields are enabled before savetry {super.commit();// make sure the enum SolrField.SolrFieldName is current