mirror of https://github.com/apache/lucene.git
SOLR-9270: spatialContextFactory now accepts "JTS" alias. Spatial config attributes with old package names are now rewritten with a warning.
This commit is contained in:
parent
67b638880d
commit
360b9a3528
|
@ -91,6 +91,10 @@ New Features
|
||||||
* SOLR-9090: Add directUpdatesToLeadersOnly flag to solrj CloudSolrClient.
|
* SOLR-9090: Add directUpdatesToLeadersOnly flag to solrj CloudSolrClient.
|
||||||
(Marvin Justice, Christine Poerschke)
|
(Marvin Justice, Christine Poerschke)
|
||||||
|
|
||||||
|
* SOLR-9270: Allow spatialContextFactory to be simply "JTS". And if any spatial params include the old
|
||||||
|
Spatial4j package "com.spatial4j.core" it is rewritten to "org.locationtech.spatial4j" with a warning.
|
||||||
|
(David Smiley)
|
||||||
|
|
||||||
Bug Fixes
|
Bug Fixes
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
@ -611,6 +615,10 @@ Upgrading from Solr 5.x
|
||||||
* SolrJ no longer includes DateUtil. If for some reason you need to format or parse dates, simply use Instant.format()
|
* SolrJ no longer includes DateUtil. If for some reason you need to format or parse dates, simply use Instant.format()
|
||||||
and Instant.parse().
|
and Instant.parse().
|
||||||
|
|
||||||
|
* If you are using an RPT or other spatial field referencing Spatial4j in its configuration, then replace the string
|
||||||
|
"com.spatial4j.core" with "org.locationtech.spatial4j". Consider updating direct to Solr 6.2 which accepts the
|
||||||
|
old value, albeit with a warning.
|
||||||
|
|
||||||
Detailed Change List
|
Detailed Change List
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,23 @@ public abstract class AbstractSpatialFieldType<T extends SpatialStrategy> extend
|
||||||
protected void init(IndexSchema schema, Map<String, String> args) {
|
protected void init(IndexSchema schema, Map<String, String> args) {
|
||||||
super.init(schema, args);
|
super.init(schema, args);
|
||||||
|
|
||||||
if(ctx==null) { // subclass can set this directly
|
if (ctx==null) { // subclass can set this directly
|
||||||
|
final String CTX_PARAM = "spatialContextFactory";
|
||||||
|
final String OLD_SPATIAL4J_PREFIX = "com.spatial4j.core";
|
||||||
|
final String NEW_SPATIAL4J_PREFIX = "org.locationtech.spatial4j";
|
||||||
|
for (Map.Entry<String, String> argEntry : args.entrySet()) {
|
||||||
|
// "JTS" is a convenience alias
|
||||||
|
if (argEntry.getKey().equals(CTX_PARAM) && argEntry.getValue().equals("JTS")) {
|
||||||
|
argEntry.setValue("org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Warn about using old Spatial4j class names
|
||||||
|
if (argEntry.getValue().contains(OLD_SPATIAL4J_PREFIX)) {
|
||||||
|
log.warn("Replace '" + OLD_SPATIAL4J_PREFIX + "' with '" + NEW_SPATIAL4J_PREFIX + "' in your schema.");
|
||||||
|
argEntry.setValue(argEntry.getValue().replace(OLD_SPATIAL4J_PREFIX, NEW_SPATIAL4J_PREFIX));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Solr expects us to remove the parameters we've used.
|
//Solr expects us to remove the parameters we've used.
|
||||||
MapListener<String, String> argsWrap = new MapListener<>(args);
|
MapListener<String, String> argsWrap = new MapListener<>(args);
|
||||||
ctx = SpatialContextFactory.makeSpatialContext(argsWrap, schema.getResourceLoader().getClassLoader());
|
ctx = SpatialContextFactory.makeSpatialContext(argsWrap, schema.getResourceLoader().getClassLoader());
|
||||||
|
|
Loading…
Reference in New Issue