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 2021/10/23 21:44:37 UTC

[lucene] 01/01: LUCENE-10201: Upgrade Spatial4j to 0.8 Upgrading Spatial4j to 0.8 improving a varitety of minor things. See release notes: https://github.com/locationtech/spatial4j/releases/tag/spatial4j-0.8

This is an automated email from the ASF dual-hosted git repository.

dsmiley pushed a commit to branch lucene10201_spatial4j_08
in repository https://gitbox.apache.org/repos/asf/lucene.git

commit 4e0f284d98c1572c6c385c076505ddf873a1b9d6
Author: David Smiley <ds...@salesforce.com>
AuthorDate: Sat Oct 23 17:44:05 2021 -0400

    LUCENE-10201: Upgrade Spatial4j to 0.8
    Upgrading Spatial4j to 0.8 improving a varitety of minor things.
    See release notes:
    https://github.com/locationtech/spatial4j/releases/tag/spatial4j-0.8
    
    Test-only dependency on JTS is upgraded to 1.17 as well
---
 lucene/CHANGES.txt                                      |  4 ++++
 lucene/licenses/jts-core-1.15.0.jar.sha1                |  1 -
 lucene/licenses/jts-core-1.17.0.jar.sha1                |  1 +
 lucene/licenses/spatial4j-0.7-tests.jar.sha1            |  1 -
 lucene/licenses/spatial4j-0.7.jar.sha1                  |  1 -
 lucene/licenses/spatial4j-0.8-tests.jar.sha1            |  1 +
 lucene/licenses/spatial4j-0.8.jar.sha1                  |  1 +
 .../apache/lucene/spatial/query/SpatialArgsParser.java  | 17 ++++++++++-------
 versions.lock                                           |  4 ++--
 versions.props                                          |  4 ++--
 10 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 3cf94ac..0f47214 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -322,6 +322,10 @@ Improvements
 
 * LUCENE-10103: Make QueryCache respect Accountable queries. (Haoyu Zhai)
 
+* LUCENE-10201: Spatial-Extras: Upgrading Spatial4j to 0.8 improving a varitety of minor things.
+  See release notes. https://github.com/locationtech/spatial4j/releases/tag/spatial4j-0.8
+  (David Smiley)
+
 Bug fixes
 ---------------------
 
diff --git a/lucene/licenses/jts-core-1.15.0.jar.sha1 b/lucene/licenses/jts-core-1.15.0.jar.sha1
deleted file mode 100644
index 086ea96..0000000
--- a/lucene/licenses/jts-core-1.15.0.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-705981b7e25d05a76a3654e597dab6ba423eb79e
diff --git a/lucene/licenses/jts-core-1.17.0.jar.sha1 b/lucene/licenses/jts-core-1.17.0.jar.sha1
new file mode 100644
index 0000000..f1f3fbe
--- /dev/null
+++ b/lucene/licenses/jts-core-1.17.0.jar.sha1
@@ -0,0 +1 @@
+7e1973b5babdd98734b1ab903fc1155714402eec
diff --git a/lucene/licenses/spatial4j-0.7-tests.jar.sha1 b/lucene/licenses/spatial4j-0.7-tests.jar.sha1
deleted file mode 100644
index 0127b0f..0000000
--- a/lucene/licenses/spatial4j-0.7-tests.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-1cf04898a92917fd038ac5a92490a8c415f671b9
diff --git a/lucene/licenses/spatial4j-0.7.jar.sha1 b/lucene/licenses/spatial4j-0.7.jar.sha1
deleted file mode 100644
index ef24065..0000000
--- a/lucene/licenses/spatial4j-0.7.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-faa8ba85d503da4ab872d17ba8c00da0098ab2f2
diff --git a/lucene/licenses/spatial4j-0.8-tests.jar.sha1 b/lucene/licenses/spatial4j-0.8-tests.jar.sha1
new file mode 100644
index 0000000..5fa337d
--- /dev/null
+++ b/lucene/licenses/spatial4j-0.8-tests.jar.sha1
@@ -0,0 +1 @@
+134b5215f13b90e4de68e5792d507a282848ef68
diff --git a/lucene/licenses/spatial4j-0.8.jar.sha1 b/lucene/licenses/spatial4j-0.8.jar.sha1
new file mode 100644
index 0000000..4bb173e
--- /dev/null
+++ b/lucene/licenses/spatial4j-0.8.jar.sha1
@@ -0,0 +1 @@
+f3ff59c2c540102ae157a1786cb80e82ce9c9f19
diff --git a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/query/SpatialArgsParser.java b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/query/SpatialArgsParser.java
index 8c49d6a..3d284cb 100644
--- a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/query/SpatialArgsParser.java
+++ b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/query/SpatialArgsParser.java
@@ -16,6 +16,7 @@
  */
 package org.apache.lucene.spatial.query;
 
+import java.io.IOException;
 import java.text.ParseException;
 import java.util.HashMap;
 import java.util.Locale;
@@ -28,10 +29,10 @@ import org.locationtech.spatial4j.shape.Shape;
 /**
  * Parses a string that usually looks like "OPERATION(SHAPE)" into a {@link SpatialArgs} object. The
  * set of operations supported are defined in {@link SpatialOperation}, such as "Intersects" being a
- * common one. The shape portion is defined by WKT {@link
- * org.locationtech.spatial4j.io.WktShapeParser}, but it can be overridden/customized via {@link
- * #parseShape(String, org.locationtech.spatial4j.context.SpatialContext)}. There are some optional
- * name-value pair parameters that follow the closing parenthesis. Example:
+ * common one. The shape portion is defined by WKT {@link org.locationtech.spatial4j.io.WKTReader},
+ * but it can be overridden/customized via {@link #parseShape(String,
+ * org.locationtech.spatial4j.context.SpatialContext)}. There are some optional name-value pair
+ * parameters that follow the closing parenthesis. Example:
  *
  * <pre>
  *   Intersects(ENVELOPE(-10,-8,22,20)) distErrPct=0.025
@@ -116,10 +117,12 @@ public class SpatialArgsParser {
     args.setDistErr(readDouble(nameValPairs.remove(DIST_ERR)));
   }
 
-  @SuppressWarnings("deprecation")
   protected Shape parseShape(String str, SpatialContext ctx) throws ParseException {
-    // return ctx.readShape(str);//still in Spatial4j 0.4 but will be deleted
-    return ctx.readShapeFromWkt(str);
+    try {
+      return ctx.getFormats().getWktReader().read(str);
+    } catch (IOException e) {
+      throw new ParseException(e.toString(), 0); // impossible but whatever;
+    }
   }
 
   protected static Double readDouble(String v) {
diff --git a/versions.lock b/versions.lock
index 930f68c..17093f9 100644
--- a/versions.lock
+++ b/versions.lock
@@ -19,7 +19,7 @@ org.carrot2:morfologik-fsa:2.1.5 (1 constraints: d70d9836)
 org.carrot2:morfologik-polish:2.1.5 (1 constraints: 0a05fd35)
 org.carrot2:morfologik-stemming:2.1.5 (2 constraints: 0b12640c)
 org.hamcrest:hamcrest:2.2 (1 constraints: a8041f2c)
-org.locationtech.spatial4j:spatial4j:0.7 (1 constraints: ab041e2c)
+org.locationtech.spatial4j:spatial4j:0.8 (1 constraints: ac041f2c)
 org.ow2.asm:asm:7.2 (2 constraints: 900e3e5e)
 org.ow2.asm:asm-commons:7.2 (1 constraints: ad042e2c)
 ua.net.nlp:morfologik-ukrainian-search:4.9.1 (1 constraints: 10051b36)
@@ -33,4 +33,4 @@ org.eclipse.jetty:jetty-server:9.4.41.v20210516 (1 constraints: 7907fe7c)
 org.eclipse.jetty:jetty-servlet:9.4.41.v20210516 (1 constraints: 7907fe7c)
 org.eclipse.jetty:jetty-util:9.4.41.v20210516 (3 constraints: 422efaf1)
 org.eclipse.jetty:jetty-util-ajax:9.4.41.v20210516 (1 constraints: 64101be2)
-org.locationtech.jts:jts-core:1.15.0 (1 constraints: 3905383b)
+org.locationtech.jts:jts-core:1.17.0 (1 constraints: 3b053e3b)
diff --git a/versions.props b/versions.props
index f5010d3..001497b 100644
--- a/versions.props
+++ b/versions.props
@@ -23,8 +23,8 @@ org.apache.opennlp:opennlp-tools=1.9.1
 org.carrot2:morfologik-*=2.1.5
 org.eclipse.jetty:*=9.4.41.v20210516
 org.hamcrest:*=2.2
-org.locationtech.jts:jts-core=1.15.0
-org.locationtech.spatial4j:*=0.7
+org.locationtech.jts:jts-core=1.17.0
+org.locationtech.spatial4j:*=0.8
 org.ow2.asm:*=7.2
 ua.net.nlp:morfologik-ukrainian-search=4.9.1
 xerces:xercesImpl=2.12.0