Skip to content

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

fix for schema export to consider also automatically generated coordinate fields

Michael Peter Christen008288719ce2
diff --git a/.gitignore b/.gitignore
index 8a0c462e8..f04e65817 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,4 @@ RELEASE/
.DS_Store
lib/yacy-cora.jar
/DATA.bkp
+/DATA.1
diff --git a/htroot/api/schema.java b/htroot/api/schema.java
index b8754dca5..41a5c41f4 100644
--- a/htroot/api/schema.java
+++ b/htroot/api/schema.java
@@ -54,6 +54,16 @@ public class schema {
c++;
}
}
+ if (schemaName.equals(CollectionSchema.CORE_NAME)) {
+ // add additional coordinate field for collection1
+ if (solrSchema.contains(CollectionSchema.coordinate_p)) {
+ addField(prop, c, CollectionSchema.coordinate_p_0_coordinate);
+ c++;
+ addField(prop, c, CollectionSchema.coordinate_p_1_coordinate);
+ c++;
+ }
+ }
+
//if (solrScheme.contains(YaCySchema.author)) {addField(prop, c, YaCySchema.author_sxt);}
prop.put("fields", c);
diff --git a/source/net/yacy/cora/federate/solr/SolrType.java b/source/net/yacy/cora/federate/solr/SolrType.java
index b45575fb3..855e9e87e 100644
--- a/source/net/yacy/cora/federate/solr/SolrType.java
+++ b/source/net/yacy/cora/federate/solr/SolrType.java
@@ -25,13 +25,14 @@ public enum SolrType {
string("s", "sxt"), // The type is not analyzed, but indexed/stored verbatim
text_general("t", "txt"), // tokenizes with StandardTokenizer, removes stop words from case-insensitive "stopwords.txt", down cases, applies synonyms.
text_en_splitting_tight(null, null), // can insert dashes in the wrong place and still match
- location("p", null), // lat,lon - format: specialized field for geospatial search. If indexed, this fieldType must not be multivalued.
+ location("p", null), // lat,lon - format: specialized field for geospatial search.
date("dt", null), // date format as in http://www.w3.org/TR/xmlschema-2/#dateTime with trailing 'Z'
bool("b", "bs", "boolean"),
num_integer("i", "val", "int"),
num_long("l", "ls", "long"),
num_float("f", "fs", "float"),
- num_double("d", "ds", "double");
+ num_double("d", "ds", "double"),
+ coordinate("coordinate", "coordinatex", "tdouble");
private String printName, singlevalExt, multivalExt;
private SolrType(final String singlevalExt, final String multivalExt) {
diff --git a/source/net/yacy/cora/federate/solr/connector/SolrServerConnector.java b/source/net/yacy/cora/federate/solr/connector/SolrServerConnector.java
index dd6210540..68e55932b 100644
--- a/source/net/yacy/cora/federate/solr/connector/SolrServerConnector.java
+++ b/source/net/yacy/cora/federate/solr/connector/SolrServerConnector.java
@@ -193,7 +193,6 @@ public abstract class SolrServerConnector extends AbstractSolrConnector implemen
this.server.add(solrdoc, -1);
}
} catch (Throwable ee) {
- log.warn(e.getMessage() + " DOC=" + solrdoc.toString());
throw new IOException(ee);
}
}
diff --git a/source/net/yacy/peers/Protocol.java b/source/net/yacy/peers/Protocol.java
index 97aa7d110..7487fda49 100644
--- a/source/net/yacy/peers/Protocol.java
+++ b/source/net/yacy/peers/Protocol.java
@@ -813,7 +813,7 @@ public final class Protocol {
UTF8.getBytes(target.hash),
EventOrigin.QUERIES);
} catch ( final IOException e ) {
- Network.log.logWarning("could not store search result", e);
+ Network.log.logWarning("could not store search result");
continue; // db-error
}
@@ -1176,7 +1176,7 @@ public final class Protocol {
event.add(container, facets, snippets, false, target.getName() + "/" + target.hash, (int) docList.getNumFound());
event.rankingProcess.addFinalize();
event.addExpectedRemoteReferences(-count);
- Network.log.logInfo("remote search (solr): peer " + target.getName() + " sent " + container.get(0).size() + "/" + docList.size() + " references");
+ Network.log.logInfo("remote search (solr): peer " + target.getName() + " sent " + (container.size() == 0 ? 0 : container.get(0).size()) + "/" + docList.size() + " references");
}
return docList.size();
}
diff --git a/source/net/yacy/search/schema/CollectionConfiguration.java b/source/net/yacy/search/schema/CollectionConfiguration.java
index ef6c993f4..39680983d 100644
--- a/source/net/yacy/search/schema/CollectionConfiguration.java
+++ b/source/net/yacy/search/schema/CollectionConfiguration.java
@@ -111,7 +111,9 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
for (CollectionSchema field: CollectionSchema.values()) {
if (this.get(field.name()) == null) {
if (CollectionSchema.author_sxt.getSolrFieldName().endsWith(field.name())) continue; // exception for this: that is a copy-field
- Log.logWarning("SolrCollectionWriter", " solr schema file " + configurationFile.getAbsolutePath() + " is missing declaration for '" + field.name() + "'");
+ if (CollectionSchema.coordinate_p_0_coordinate.getSolrFieldName().endsWith(field.name())) continue; // exception for this: automatically generated
+ if (CollectionSchema.coordinate_p_1_coordinate.getSolrFieldName().endsWith(field.name())) continue; // exception for this: automatically generated
+ Log.logWarning("SolrCollectionWriter", " solr schema file " + configurationFile.getAbsolutePath() + " is missing declaration for '" + field.name() + "'");
}
}
}
@@ -148,8 +150,8 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
SolrInputDocument sid = new SolrInputDocument();
Set<String> omitFields = new HashSet<String>(3);
omitFields.add(CollectionSchema.author_sxt.getSolrFieldName());
- omitFields.add(CollectionSchema.coordinate_p.getSolrFieldName() + "_0_coordinate");
- omitFields.add(CollectionSchema.coordinate_p.getSolrFieldName() + "_1_coordinate");
+ omitFields.add(CollectionSchema.coordinate_p_0_coordinate.getSolrFieldName());
+ omitFields.add(CollectionSchema.coordinate_p_1_coordinate.getSolrFieldName());
for (String name: doc.getFieldNames()) {
if (this.contains(name) && !omitFields.contains(name)) { // check each field if enabled in local Solr schema
sid.addField(name, doc.getFieldValue(name), 1.0f);
diff --git a/source/net/yacy/search/schema/CollectionSchema.java b/source/net/yacy/search/schema/CollectionSchema.java
index 53b635ad2..614b0be59 100644
--- a/source/net/yacy/search/schema/CollectionSchema.java
+++ b/source/net/yacy/search/schema/CollectionSchema.java
@@ -65,6 +65,8 @@ public enum CollectionSchema implements SchemaDeclaration {
// optional but recommended
coordinate_p(SolrType.location, true, true, false, "point in degrees of latitude,longitude as declared in WSG84"),
+ coordinate_p_0_coordinate(SolrType.coordinate, true, true, false, "automatically created subfield, (latitude)"),
+ coordinate_p_1_coordinate(SolrType.coordinate, true, true, false, "automatically created subfield, (longitude)"),
ip_s(SolrType.string, true, true, false, "ip of host of url (after DNS lookup)"),
author(SolrType.text_general, true, true, false, "content of author-tag"),
author_sxt(SolrType.string, true, true, true, "content of author-tag as copy-field from author. This is used for facet generation"),