org.apache.solr.search.function
Class ReciprocalFloatFunction

java.lang.Object
  extended by org.apache.solr.search.function.ValueSource
      extended by org.apache.solr.search.function.ReciprocalFloatFunction
All Implemented Interfaces:
java.io.Serializable

public class ReciprocalFloatFunction
extends ValueSource

ReciprocalFloatFunction implements a reciprocal function f(x) = a/(mx+b), based on the float value of a field as exported by ValueSource.
When a and b are equal, and x>=0, this function has a maximum value of 1 that drops as x increases. Increasing the value of a and b together results in a movement of the entire function to a flatter part of the curve.
These properties make this an idea function for boosting more recent documents.
Example:ReciprocalFloatFunction(new ReverseOrdFieldSource("my_date"),1,1000,1000)

Version:
$Id: ReciprocalFloatFunction.java 472574 2006-11-08 18:25:52Z yonik $
Author:
yonik
See Also:
FunctionQuery, Serialized Form

Field Summary
protected  float a
           
protected  float b
           
protected  float m
           
protected  ValueSource source
           
 
Constructor Summary
ReciprocalFloatFunction(ValueSource source, float m, float a, float b)
          f(source) = a/(m*float(source)+b)
 
Method Summary
 java.lang.String description()
          description of field, used in explain()
 boolean equals(java.lang.Object o)
           
 DocValues getValues(org.apache.lucene.index.IndexReader reader)
           
 int hashCode()
           
 
Methods inherited from class org.apache.solr.search.function.ValueSource
toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

source

protected final ValueSource source

m

protected final float m

a

protected final float a

b

protected final float b
Constructor Detail

ReciprocalFloatFunction

public ReciprocalFloatFunction(ValueSource source,
                               float m,
                               float a,
                               float b)
f(source) = a/(m*float(source)+b)

Method Detail

getValues

public DocValues getValues(org.apache.lucene.index.IndexReader reader)
                    throws java.io.IOException
Specified by:
getValues in class ValueSource
Throws:
java.io.IOException

description

public java.lang.String description()
Description copied from class: ValueSource
description of field, used in explain()

Specified by:
description in class ValueSource

hashCode

public int hashCode()
Specified by:
hashCode in class ValueSource

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in class ValueSource


Copyright © 2006 - 2008 The Apache Software Foundation