org.apache.lucene.document

## Class XYShape

- java.lang.Object
- - org.apache.lucene.document.XYShape

    public class XYShape
    extends Object

A cartesian shape utility class for indexing and searching geometries whose vertices are unitless x, y values.

This class defines six static factory methods for common indexing and search operations:

- `createIndexableFields(String, XYPolygon)` for indexing a cartesian polygon.
- `createIndexableFields(String, XYLine)` for indexing a cartesian linestring.
- `createIndexableFields(String, float, float)` for indexing a x, y cartesian point.
- `newBoxQuery()` for matching cartesian shapes that have some `ShapeField.QueryRelation` with a bounding box.
- `newLineQuery()` for matching cartesian shapes that have some `ShapeField.QueryRelation` with a linestring.
- `newPolygonQuery()` for matching cartesian shapes that have some `ShapeField.QueryRelation` with a polygon.

WARNING: Like `LatLonPoint`, vertex values are indexed with some loss of precision from the original `double` values.

See Also:
  `PointValues`, `LatLonDocValuesField`
WARNING: This API is experimental and might change in incompatible ways in the next release.

### Method Summary

All Methods Static Methods Concrete Methods
`static Field[]` `createIndexableFields(String fieldName, float x, float y)` create indexable fields for cartesian point geometry
`static Field[]` `createIndexableFields(String fieldName, XYLine line)` create indexable fields for cartesian line geometry
`static Field[]` `createIndexableFields(String fieldName, XYPolygon polygon)` create indexable fields for cartesian polygon geometry
`static Query` `newBoxQuery(String field, ShapeField.QueryRelation queryRelation, float minX, float maxX, float minY, float maxY)` create a query to find all cartesian shapes that intersect a defined bounding box
`static Query` `newLineQuery(String field, ShapeField.QueryRelation queryRelation, XYLine... lines)` create a query to find all cartesian shapes that intersect a provided linestring (or array of linestrings)
`static Query` `newPolygonQuery(String field, ShapeField.QueryRelation queryRelation, XYPolygon... polygons)` create a query to find all cartesian shapes that intersect a provided polygon (or array of polygons)

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### createIndexableFields

    public static Field[] createIndexableFields(String fieldName,
                                                XYPolygon polygon)

create indexable fields for cartesian polygon geometry

#### createIndexableFields

    public static Field[] createIndexableFields(String fieldName,
                                                XYLine line)

create indexable fields for cartesian line geometry

#### createIndexableFields

    public static Field[] createIndexableFields(String fieldName,
                                                float x,
                                                float y)

create indexable fields for cartesian point geometry

#### newBoxQuery

    public static Query newBoxQuery(String field,
                                    ShapeField.QueryRelation queryRelation,
                                    float minX,
                                    float maxX,
                                    float minY,
                                    float maxY)

create a query to find all cartesian shapes that intersect a defined bounding box

#### newLineQuery

    public static Query newLineQuery(String field,
                                     ShapeField.QueryRelation queryRelation,
                                     XYLine... lines)

create a query to find all cartesian shapes that intersect a provided linestring (or array of linestrings)

#### newPolygonQuery

    public static Query newPolygonQuery(String field,
                                        ShapeField.QueryRelation queryRelation,
                                        XYPolygon... polygons)

create a query to find all cartesian shapes that intersect a provided polygon (or array of polygons)