Skip to content

Apache Lucene open-source search software

Add interface to relate a LatLonShape with another shape represented as Component2D. (#11753)

Navneet Vermae7253f112de9
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 11fa354e4c6..5cbec01f8cc 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -107,7 +107,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
@@ -168,6 +168,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);
+ }
}