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 Description protected String
name
-
Fields inherited from class org.apache.solr.search.function.distance.VectorDistanceFunction
oneOverPower, power, source1, source2
-
-
Constructor Summary
Constructors Constructor Description SquaredEuclideanFunction(org.apache.lucene.queries.function.valuesource.MultiValueSource source1, org.apache.lucene.queries.function.valuesource.MultiValueSource source2)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
distance(int doc, org.apache.lucene.queries.function.FunctionValues dv1, org.apache.lucene.queries.function.FunctionValues dv2)
Calculate the distanceboolean
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
-
-
-
-
Field Detail
-
name
protected String name
-
-
Method Detail
-
name
protected String name()
- Overrides:
name
in classVectorDistanceFunction
-
distance
protected double distance(int doc, org.apache.lucene.queries.function.FunctionValues dv1, org.apache.lucene.queries.function.FunctionValues dv2) throws IOException
Description copied from class:VectorDistanceFunction
Calculate the distance- Overrides:
distance
in classVectorDistanceFunction
- Parameters:
doc
- The doc to scoredv1
- The values from the first MultiValueSourcedv2
- The values from the second MultiValueSource- Returns:
- The distance
- Throws:
IOException
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classVectorDistanceFunction
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classVectorDistanceFunction
-
-