You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ds...@apache.org on 2016/07/09 14:49:27 UTC
lucene-solr:master: SOLR-9270: spatialContextFactory now accepts
"JTS" alias. Spatial config attributes with old package names are now
rewritten with a warning.
Repository: lucene-solr
Updated Branches:
refs/heads/master 67b638880 -> 360b9a352
SOLR-9270: spatialContextFactory now accepts "JTS" alias. Spatial config attributes with old package names are now rewritten with a warning.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/360b9a35
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/360b9a35
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/360b9a35
Branch: refs/heads/master
Commit: 360b9a35282a005fd4a9acddfafb3814592baba8
Parents: 67b6388
Author: David Smiley <ds...@apache.org>
Authored: Sat Jul 9 10:49:12 2016 -0400
Committer: David Smiley <ds...@apache.org>
Committed: Sat Jul 9 10:49:12 2016 -0400
----------------------------------------------------------------------
solr/CHANGES.txt | 8 ++++++++
.../solr/schema/AbstractSpatialFieldType.java | 18 +++++++++++++++++-
2 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/360b9a35/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index ba21abb..8b67d5a 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -91,6 +91,10 @@ New Features
* SOLR-9090: Add directUpdatesToLeadersOnly flag to solrj CloudSolrClient.
(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
----------------------
@@ -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()
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
----------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/360b9a35/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java b/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java
index 12fcea3..10756da 100644
--- a/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java
+++ b/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java
@@ -119,7 +119,23 @@ public abstract class AbstractSpatialFieldType<T extends SpatialStrategy> extend
protected void init(IndexSchema schema, Map<String, String> 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.
MapListener<String, String> argsWrap = new MapListener<>(args);
ctx = SpatialContextFactory.makeSpatialContext(argsWrap, schema.getResourceLoader().getClassLoader());