DistanceToShapeValueSource (Lucene 10.5.1 spatial-extras API)
Description: declaration: package: org.apache.lucene.spatial.util, class: DistanceToShapeValueSource

Package org.apache.lucene.spatial.util

# Class DistanceToShapeValueSource

java.lang.Object
org.apache.lucene.search.DoubleValuesSource
org.apache.lucene.spatial.util.DistanceToShapeValueSource

All Implemented Interfaces:
  `SegmentCacheable`

public class DistanceToShapeValueSource extends DoubleValuesSource
The distance from a provided Point to a Point retrieved from an ShapeValuesSource. The distance is calculated via a `DistanceCalculator`.

WARNING: This API is experimental and might change in incompatible ways in the next release.

- ## Field Summary

  ### Fields inherited from class org.apache.lucene.search.DoubleValuesSource

  `SCORES`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DistanceToShapeValueSource(ShapeValuesSource shapeValueSource, org.locationtech.spatial4j.shape.Point queryPoint, double multiplier, org.locationtech.spatial4j.context.SpatialContext ctx)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object o)`
  `DoubleValues`
  `getValues(LeafReaderContext readerContext, DoubleValues scores)`
  `int`
  `hashCode()`
  `boolean`
  `isCacheable(LeafReaderContext ctx)`
  `boolean`
  `needsScores()`
  `DoubleValuesSource`
  `rewrite(IndexSearcher searcher)`
  `String`
  `toString()`

  ### Methods inherited from class org.apache.lucene.search.DoubleValuesSource

  `constant, explain, fromDoubleField, fromField, fromFloatField, fromIntField, fromLongField, fromQuery, fromScorer, getSortField, getSortField, similarityToQueryVector, similarityToQueryVector, toLongValuesSource, toSortableLongDoubleValuesSource`

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

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

- ## Constructor Details

  - ### DistanceToShapeValueSource

    public DistanceToShapeValueSource(ShapeValuesSource shapeValueSource, org.locationtech.spatial4j.shape.Point queryPoint, double multiplier, org.locationtech.spatial4j.context.SpatialContext ctx)

- ## Method Details

  - ### toString

    public String toString()
    Specified by:
      `toString` in class `DoubleValuesSource`

  - ### getValues

    public DoubleValues getValues(LeafReaderContext readerContext, DoubleValues scores) throws IOException
    Specified by:
      `getValues` in class `DoubleValuesSource`
    Throws:
      `IOException`

  - ### needsScores

    public boolean needsScores()
    Specified by:
      `needsScores` in class `DoubleValuesSource`

  - ### isCacheable

    public boolean isCacheable(LeafReaderContext ctx)

  - ### rewrite

    public DoubleValuesSource rewrite(IndexSearcher searcher) throws IOException
    Specified by:
      `rewrite` in class `DoubleValuesSource`
    Throws:
      `IOException`

  - ### equals

    public boolean equals(Object o)
    Specified by:
      `equals` in class `DoubleValuesSource`

  - ### hashCode

    public int hashCode()
    Specified by:
      `hashCode` in class `DoubleValuesSource`