Skip to content

Commit

Permalink
Add interface to relate a LatLonShape with another shape represented …
Browse files Browse the repository at this point in the history
…as Component2D. (apache#11753)

Adds createLatLonShapeDocValues and createXYShapeDocValues factory methods
to LatLonShape and XYShape factory classes, respectively.

Signed-off-by: Nicholas Walter Knize <[email protected]>
  • Loading branch information
navneet1v authored Oct 28, 2022
1 parent 5c7edd7 commit e7253f1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lucene/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
---------------------

Expand Down
11 changes: 11 additions & 0 deletions lucene/core/src/java/org/apache/lucene/document/LatLonShape.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
* 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
Expand Down Expand Up @@ -341,6 +342,16 @@ public static Query newGeometryQuery(
}
}

/**
* 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) {
Expand Down
11 changes: 11 additions & 0 deletions lucene/core/src/java/org/apache/lucene/document/XYShape.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
* 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
Expand Down Expand Up @@ -269,4 +270,14 @@ public static Query newGeometryQuery(
}
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);
}
}

0 comments on commit e7253f1

Please sign in to comment.