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

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

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
This commit is contained in:
Navneet Verma 2022-10-28 11:52:20 -07:00 committed by GitHub
parent 5c7edd7f38
commit e7253f112d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 1 deletions

View File

@ -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
---------------------

View File

@ -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) {

View File

@ -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);
}
}