Companion

object Companion

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun computePivotFeatureValue(searcher: IndexSearcher, featureField: String, featureName: String): Float

Compute a feature value that may be used as the pivot parameter of the .newSaturationQuery and .newSigmoidQuery factory methods. The implementation takes the average of the int bits of the float representation in practice before converting it back to a float. Given that floats store the exponent in the higher bits, it means that the result will be an approximation of the geometric mean of all feature values.

Link copied to clipboard
Link copied to clipboard
fun newDoubleValues(field: String, featureName: String): DoubleValuesSource

Creates a DoubleValuesSource instance which can be used to read the values of a feature from the a FeatureField for documents.

Link copied to clipboard
fun newFeatureSort(field: String, featureName: String): SortField

Creates a SortField for sorting by the value of a feature.

Link copied to clipboard
fun newLinearQuery(fieldName: String, featureName: String, weight: Float): Query

Return a new Query that will score documents as weight * S where S is the value of the static feature.

Link copied to clipboard
fun newLogQuery(fieldName: String, featureName: String, weight: Float, scalingFactor: Float): Query

Return a new Query that will score documents as weight * Math.log(scalingFactor + S) where S is the value of the static feature.

Link copied to clipboard
fun newSaturationQuery(fieldName: String, featureName: String): Query

Same as .newSaturationQuery but 1f is used as a weight and a reasonably good default pivot value is computed based on index statistics and is approximately equal to the geometric mean of all values that exist in the index.

fun newSaturationQuery(fieldName: String, featureName: String, weight: Float, pivot: Float?): Query

Return a new Query that will score documents as weight * S / (S + pivot) where S is the value of the static feature.

Link copied to clipboard
fun newSigmoidQuery(fieldName: String, featureName: String, weight: Float, pivot: Float, exp: Float): Query

Return a new Query that will score documents as weight * S^a / (S^a + pivot^a) where S is the value of the static feature.