org.apache.solr.search.function.distance
Class SquaredEuclideanFunction

java.lang.Object
  extended by org.apache.lucene.queries.function.ValueSource
      extended by org.apache.solr.search.function.distance.VectorDistanceFunction
          extended by 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
protected  String name
           
 
Fields inherited from class org.apache.solr.search.function.distance.VectorDistanceFunction
oneOverPower, power, source1, source2
 
Constructor Summary
SquaredEuclideanFunction(MultiValueSource source1, MultiValueSource source2)
           
 
Method Summary
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, getValues
 
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-2013 Apache Software Foundation. All Rights Reserved.