Geo3DDocValuesField (Lucene 10.5.0 spatial3d API)
Description: declaration: package: org.apache.lucene.spatial3d, class: Geo3DDocValuesField

Package org.apache.lucene.spatial3d

# Class Geo3DDocValuesField

java.lang.Object
org.apache.lucene.document.Field
org.apache.lucene.spatial3d.Geo3DDocValuesField

All Implemented Interfaces:
  `IndexableField`

public class Geo3DDocValuesField extends Field
An per-document 3D location field.

Sorting by distance is efficient. Multiple values for the same field in one document is allowed.

This field defines static factory methods for common operations:

- TBD

If you also need query operations, you should add a separate `Geo3DPoint` instance.

WARNING: Values are indexed with some loss of precision from the original `double` values (4.190951585769653E-8 for the latitude component and 8.381903171539307E-8 for longitude).

See Also:
  - `Geo3DPoint`

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.apache.lucene.document.Field

  `Field.Store`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final FieldType`
  `TYPE`
  Type for a Geo3DDocValuesField

  ### Fields inherited from class org.apache.lucene.document.Field

  `fieldsData, name, type`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Geo3DDocValuesField(String name, double x, double y, double z, PlanetModel planetModel)`
  Creates a new Geo3DDocValuesField with the specified x, y, and z
  `Geo3DDocValuesField(String name, GeoPoint point, PlanetModel planetModel)`
  Creates a new Geo3DDocValuesField with the specified x, y, and z

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static SortField`
  `newDistanceSort(String field, double latitude, double longitude, double maxRadiusMeters, PlanetModel planetModel)`
  Creates a SortField for sorting by distance within a circle.
  `static SortField`
  `newOutsideBoxSort(String field, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude, PlanetModel planetModel)`
  Creates a SortField for sorting by outside distance from a box.
  `static SortField`
  `newOutsideDistanceSort(String field, double latitude, double longitude, double maxRadiusMeters, PlanetModel planetModel)`
  Creates a SortField for sorting by outside distance from a circle.
  `static SortField`
  `newOutsideLargePolygonSort(String field, PlanetModel planetModel, Polygon... polygons)`
  Creates a SortField for sorting by outside distance from a large polygon.
  `static SortField`
  `newOutsidePathSort(String field, double[] pathLatitudes, double[] pathLongitudes, double pathWidthMeters, PlanetModel planetModel)`
  Creates a SortField for sorting by outside distance from a path.
  `static SortField`
  `newOutsidePolygonSort(String field, PlanetModel planetModel, Polygon... polygons)`
  Creates a SortField for sorting by outside distance from a polygon.
  `static SortField`
  `newPathSort(String field, double[] pathLatitudes, double[] pathLongitudes, double pathWidthMeters, PlanetModel planetModel)`
  Creates a SortField for sorting by distance along a path.
  `void`
  `setLocationValue(double x, double y, double z)`
  Change the values of this field
  `void`
  `setLocationValue(GeoPoint point)`
  Change the values of this field
  `String`
  `toString()`

  ### Methods inherited from class org.apache.lucene.document.Field

  `binaryValue, fieldType, getCharSequenceValue, invertableType, name, numericValue, readerValue, setBytesValue, setBytesValue, setByteValue, setDoubleValue, setFloatValue, setIntValue, setLongValue, setReaderValue, setShortValue, setStringValue, setTokenStream, storedValue, stringValue, tokenStream, tokenStreamValue`

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

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

- ## Field Details

  - ### TYPE

    public static final FieldType TYPE
    Type for a Geo3DDocValuesField

    Each value stores a 64-bit long where the three values (x, y, and z) are given 21 bits each. Each 21-bit value represents the maximum extent in that dimension for the defined planet model.

- ## Constructor Details

  - ### Geo3DDocValuesField

    public Geo3DDocValuesField(String name, GeoPoint point, PlanetModel planetModel)
    Creates a new Geo3DDocValuesField with the specified x, y, and z
    Parameters:
      `name` - field name
      `point` - is the point.
    Throws:
      `IllegalArgumentException` - if the field name is null or the point is out of bounds

  - ### Geo3DDocValuesField

    public Geo3DDocValuesField(String name, double x, double y, double z, PlanetModel planetModel)
    Creates a new Geo3DDocValuesField with the specified x, y, and z
    Parameters:
      `name` - field name
      `x` - is the x value for the point.
      `y` - is the y value for the point.
      `z` - is the z value for the point.
    Throws:
      `IllegalArgumentException` - if the field name is null or x, y, or z are out of bounds

- ## Method Details

  - ### setLocationValue

    public void setLocationValue(GeoPoint point)
    Change the values of this field
    Parameters:
      `point` - is the point.
    Throws:
      `IllegalArgumentException` - if the point is out of bounds

  - ### setLocationValue

    public void setLocationValue(double x, double y, double z)
    Change the values of this field
    Parameters:
      `x` - is the x value for the point.
      `y` - is the y value for the point.
      `z` - is the z value for the point.
    Throws:
      `IllegalArgumentException` - if x, y, or z are out of bounds

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Field`

  - ### newDistanceSort

    public static SortField newDistanceSort(String field, double latitude, double longitude, double maxRadiusMeters, PlanetModel planetModel)
    Creates a SortField for sorting by distance within a circle.

    This sort orders documents by ascending distance from the location. The value returned in `FieldDoc` for the hits contains a Double instance with the distance in meters.

    If a document is missing the field, then by default it is treated as having `Double.POSITIVE_INFINITY` distance (missing values sort last).

    If a document contains multiple values for the field, the closest distance from the circle center is used.

    Parameters:
      `field` - field name. must not be null.
      `latitude` - latitude at the center: must be within standard +/-90 coordinate bounds.
      `longitude` - longitude at the center: must be within standard +/-180 coordinate bounds.
      `maxRadiusMeters` - is the maximum radius in meters.
    Returns:
      SortField ordering documents by distance
    Throws:
      `IllegalArgumentException` - if `field` is null or circle has invalid coordinates.

  - ### newPathSort

    public static SortField newPathSort(String field, double[] pathLatitudes, double[] pathLongitudes, double pathWidthMeters, PlanetModel planetModel)
    Creates a SortField for sorting by distance along a path.

    This sort orders documents by ascending distance along the described path. The value returned in `FieldDoc` for the hits contains a Double instance with the distance in meters.

    If a document is missing the field, then by default it is treated as having `Double.POSITIVE_INFINITY` distance (missing values sort last).

    If a document contains multiple values for the field, the closest distance along the path is used.

    Parameters:
      `field` - field name. must not be null.
      `pathLatitudes` - latitude values for points of the path: must be within standard +/-90 coordinate bounds.
      `pathLongitudes` - longitude values for points of the path: must be within standard +/-180 coordinate bounds.
      `pathWidthMeters` - width of the path in meters.
    Returns:
      SortField ordering documents by distance
    Throws:
      `IllegalArgumentException` - if `field` is null or path has invalid coordinates.

  - ### newOutsideDistanceSort

    public static SortField newOutsideDistanceSort(String field, double latitude, double longitude, double maxRadiusMeters, PlanetModel planetModel)
    Creates a SortField for sorting by outside distance from a circle.

    This sort orders documents by ascending outside distance from the circle. Points within the circle have distance 0.0. The value returned in `FieldDoc` for the hits contains a Double instance with the distance in meters.

    If a document is missing the field, then by default it is treated as having `Double.POSITIVE_INFINITY` distance (missing values sort last).

    If a document contains multiple values for the field, the closest distance to the circle is used.

    Parameters:
      `field` - field name. must not be null.
      `latitude` - latitude at the center: must be within standard +/-90 coordinate bounds.
      `longitude` - longitude at the center: must be within standard +/-180 coordinate bounds.
      `maxRadiusMeters` - is the maximum radius in meters.
    Returns:
      SortField ordering documents by distance
    Throws:
      `IllegalArgumentException` - if `field` is null or location has invalid coordinates.

  - ### newOutsideBoxSort

    public static SortField newOutsideBoxSort(String field, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude, PlanetModel planetModel)
    Creates a SortField for sorting by outside distance from a box.

    This sort orders documents by ascending outside distance from the box. Points within the box have distance 0.0. The value returned in `FieldDoc` for the hits contains a Double instance with the distance in meters.

    If a document is missing the field, then by default it is treated as having `Double.POSITIVE_INFINITY` distance (missing values sort last).

    If a document contains multiple values for the field, the closest distance to the box is used.

    Parameters:
      `field` - field name. must not be null.
      `minLatitude` - latitude lower bound: must be within standard +/-90 coordinate bounds.
      `maxLatitude` - latitude upper bound: must be within standard +/-90 coordinate bounds.
      `minLongitude` - longitude lower bound: must be within standard +/-180 coordinate bounds.
      `maxLongitude` - longitude upper bound: must be within standard +/-180 coordinate bounds.
    Returns:
      SortField ordering documents by distance
    Throws:
      `IllegalArgumentException` - if `field` is null or box has invalid coordinates.

  - ### newOutsidePolygonSort

    public static SortField newOutsidePolygonSort(String field, PlanetModel planetModel, Polygon... polygons)
    Creates a SortField for sorting by outside distance from a polygon.

    This sort orders documents by ascending outside distance from the polygon. Points within the polygon have distance 0.0. The value returned in `FieldDoc` for the hits contains a Double instance with the distance in meters.

    If a document is missing the field, then by default it is treated as having `Double.POSITIVE_INFINITY` distance (missing values sort last).

    If a document contains multiple values for the field, the closest distance to the polygon is used.

    Parameters:
      `field` - field name. must not be null.
      `polygons` - is the list of polygons to use to construct the query; must be at least one.
    Returns:
      SortField ordering documents by distance
    Throws:
      `IllegalArgumentException` - if `field` is null or polygon has invalid coordinates.

  - ### newOutsideLargePolygonSort

    public static SortField newOutsideLargePolygonSort(String field, PlanetModel planetModel, Polygon... polygons)
    Creates a SortField for sorting by outside distance from a large polygon. This differs from the related newOutsideLargePolygonSort in that it does little or no legality checking and is optimized for very large numbers of polygon edges.

    This sort orders documents by ascending outside distance from the polygon. Points within the polygon have distance 0.0. The value returned in `FieldDoc` for the hits contains a Double instance with the distance in meters.

    If a document is missing the field, then by default it is treated as having `Double.POSITIVE_INFINITY` distance (missing values sort last).

    If a document contains multiple values for the field, the closest distance to the polygon is used.

    Parameters:
      `field` - field name. must not be null.
      `polygons` - is the list of polygons to use to construct the query; must be at least one.
    Returns:
      SortField ordering documents by distance
    Throws:
      `IllegalArgumentException` - if `field` is null or polygon has invalid coordinates.

  - ### newOutsidePathSort

    public static SortField newOutsidePathSort(String field, double[] pathLatitudes, double[] pathLongitudes, double pathWidthMeters, PlanetModel planetModel)
    Creates a SortField for sorting by outside distance from a path.

    This sort orders documents by ascending outside distance from the described path. Points within the path are given the distance of 0.0. The value returned in `FieldDoc` for the hits contains a Double instance with the distance in meters.

    If a document is missing the field, then by default it is treated as having `Double.POSITIVE_INFINITY` distance (missing values sort last).

    If a document contains multiple values for the field, the closest distance from the path is used.

    Parameters:
      `field` - field name. must not be null.
      `pathLatitudes` - latitude values for points of the path: must be within standard +/-90 coordinate bounds.
      `pathLongitudes` - longitude values for points of the path: must be within standard +/-180 coordinate bounds.
      `pathWidthMeters` - width of the path in meters.
    Returns:
      SortField ordering documents by distance
    Throws:
      `IllegalArgumentException` - if `field` is null or path has invalid coordinates.