org.apache.solr.search.function.distance

## Class SquaredEuclideanFunction

- java.lang.Object
- - org.apache.lucene.queries.function.ValueSource
  - - org.apache.solr.search.function.distance.VectorDistanceFunction
    - - org.apache.solr.search.function.distance.SquaredEuclideanFunction

-     public class SquaredEuclideanFunction
      extends VectorDistanceFunction

  While not strictly a distance, the Sq. Euclidean Distance is often all that is needed in many applications that require a distance, thus saving a sq. rt. calculation

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected String` | `name`

    - ### Fields inherited from class org.apache.solr.search.function.distance.VectorDistanceFunction

      `oneOverPower, power, source1, source2`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SquaredEuclideanFunction(MultiValueSource source1, MultiValueSource source2)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected double` | `distance(int doc, FunctionValues dv1, FunctionValues dv2)` Calculate the distance
    `boolean` | `equals(Object o)`
    `int` | `hashCode()`
    `protected String` | `name()`

    - ### Methods inherited from class org.apache.solr.search.function.distance.VectorDistanceFunction

      `createWeight, description, distSquaredCartesian, getValues, vectorDistance, vectorDistance`

    - ### Methods inherited from class org.apache.lucene.queries.function.ValueSource

      `getSortField, newContext, toString`

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

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

- - ### Field Detail

    - #### name

          protected String name

  - ### Constructor Detail

    - #### SquaredEuclideanFunction

          public SquaredEuclideanFunction(MultiValueSource source1,
                                          MultiValueSource source2)

  - ### Method Detail

    - #### name

          protected String name()

      Overrides:
        `name` in class `VectorDistanceFunction`

    - #### distance

          protected double distance(int doc,
                                    FunctionValues dv1,
                                    FunctionValues dv2)

      Description copied from class: `VectorDistanceFunction`
      Calculate the distance
      Overrides:
        `distance` in class `VectorDistanceFunction`
      Parameters:
        `doc` - The doc to score
        `dv1` - The values from the first MultiValueSource
        `dv2` - The values from the second MultiValueSource
      Returns:
        The distance

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `VectorDistanceFunction`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `VectorDistanceFunction`

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.