You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by nk...@apache.org on 2022/10/28 20:52:42 UTC

[lucene] branch branch_9x updated: Add interface to relate a LatLonShape with another shape represented as Component2D. (#11890)

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

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


The following commit(s) were added to refs/heads/branch_9x by this push:
     new a4ef70f0656 Add interface to relate a LatLonShape with another shape represented as Component2D. (#11890)
a4ef70f0656 is described below

commit a4ef70f065663483859869113d31b80124a3f2c4
Author: Navneet Verma <na...@amazon.com>
AuthorDate: Fri Oct 28 13:52:35 2022 -0700

    Add interface to relate a LatLonShape with another shape represented as Component2D. (#11890)
    
    Adds createLatLonShapeDocValues and createXYShapeDocValues factory methods
    to LatLonShape and XYShape factory classes, respectively.
    
    Signed-off-by: Nicholas Walter Knize <nk...@apache.org>
---
 lucene/CHANGES.txt                                            |  4 +++-
 .../core/src/java/org/apache/lucene/document/LatLonShape.java | 11 +++++++++++
 lucene/core/src/java/org/apache/lucene/document/XYShape.java  | 11 +++++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index e98e5d9c10c..a82d7ccfeb6 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -17,7 +17,7 @@ API Changes
 
 * GITHUB#11761: TieredMergePolicy now allowed a maximum allowable deletes percentage of down to 5%, and the default
   maximum allowable deletes percentage is changed from 33% to 20%. (Marc D'Mello)
-  
+
 * GITHUB#11822: Configure replicator PrimaryNode replia shutdown timeout. (Steven Schlansker)
 
 New Features
@@ -73,6 +73,8 @@ Other
 
 * LUCENE-10635: Ensure test coverage for WANDScorer by using a test query. (Zach Chen, Adrien Grand)
 
+* GITHUB#11752: Added interface to relate a LatLonShape with another shape represented as Component2D. (Navneet Verma)
+
 Build
 ---------------------
 
diff --git a/lucene/core/src/java/org/apache/lucene/document/LatLonShape.java b/lucene/core/src/java/org/apache/lucene/document/LatLonShape.java
index d749b7c52b5..f99b699565b 100644
--- a/lucene/core/src/java/org/apache/lucene/document/LatLonShape.java
+++ b/lucene/core/src/java/org/apache/lucene/document/LatLonShape.java
@@ -66,6 +66,7 @@ import org.apache.lucene.util.BytesRef;
  *       QueryRelation} with a polygon.
  *   <li>{@link #newGeometryQuery newGeometryQuery()} for matching geo shapes that have some {@link
  *       QueryRelation} with one or more {@link LatLonGeometry}.
+ *   <li>{@link #createLatLonShapeDocValues(BytesRef)} for creating the {@link LatLonShapeDocValues}
  * </ul>
  *
  * <b>WARNING</b>: Like {@link LatLonPoint}, vertex values are indexed with some loss of precision
@@ -341,6 +342,16 @@ public class LatLonShape {
     }
   }
 
+  /**
+   * Factory method for creating the {@link LatLonShapeDocValues}
+   *
+   * @param bytesRef {@link BytesRef}
+   * @return {@link LatLonShapeDocValues}
+   */
+  public static LatLonShapeDocValues createLatLonShapeDocValues(BytesRef bytesRef) {
+    return new LatLonShapeDocValues(bytesRef);
+  }
+
   private static Query makeContainsGeometryQuery(String field, LatLonGeometry... latLonGeometries) {
     BooleanQuery.Builder builder = new BooleanQuery.Builder();
     for (LatLonGeometry geometry : latLonGeometries) {
diff --git a/lucene/core/src/java/org/apache/lucene/document/XYShape.java b/lucene/core/src/java/org/apache/lucene/document/XYShape.java
index de648d3ba09..1d871f876af 100644
--- a/lucene/core/src/java/org/apache/lucene/document/XYShape.java
+++ b/lucene/core/src/java/org/apache/lucene/document/XYShape.java
@@ -65,6 +65,7 @@ import org.apache.lucene.util.BytesRef;
  *       QueryRelation} with a polygon.
  *   <li>{@link #newGeometryQuery newGeometryQuery()} for matching cartesian shapes that have some
  *       {@link QueryRelation} with one or more {@link XYGeometry}.
+ *   <li>{@link #createXYShapeDocValues(BytesRef)} for creating the {@link XYShapeDocValues}
  * </ul>
  *
  * <b>WARNING</b>: Like {@link LatLonPoint}, vertex values are indexed with some loss of precision
@@ -269,4 +270,14 @@ public class XYShape {
     }
     return new XYShapeQuery(field, queryRelation, xyGeometries);
   }
+
+  /**
+   * Factory method for creating the {@link XYShapeDocValues}
+   *
+   * @param bytesRef {@link BytesRef}
+   * @return {@link XYShapeDocValues}
+   */
+  public static XYShapeDocValues createXYShapeDocValues(BytesRef bytesRef) {
+    return new XYShapeDocValues(bytesRef);
+  }
 }