fix for schema export to consider also automatically generated

coordinate fields
pull/1/head
Michael Peter Christen 12 years ago
parent 089dee1770
commit 008288719c

1
.gitignore vendored

@ -11,3 +11,4 @@ RELEASE/
.DS_Store
lib/yacy-cora.jar
/DATA.bkp
/DATA.1

@ -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);

@ -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) {

@ -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);
}
}

@ -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();
}

@ -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);

@ -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"),

Loading…
Cancel
Save