Package org.apache.lucene.monitor
Interface TermWeightor
- All Superinterfaces:
ToDoubleFunction<Term>
Calculates the weight of a
Term-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TermWeightorA default TermWeightor based on token length -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic TermWeightorcombine(TermWeightor... weightors) Combine weightors by multiplicationstatic TermWeightorfieldWeightor(double weight, String... fields) QueryTerms with a field from the selected set will be assigned the given weightstatic TermWeightorfieldWeightor(double weight, Set<String> fields) QueryTerms with a field from the selected set will be assigned the given weightstatic TermWeightorlengthWeightor(double a, double k) QueryTerms will be assigned a weight based on their term lengthstatic TermWeightortermAndFieldWeightor(double weight, Set<Term> terms) QueryTerms with a term and field value from the selected set will be assigned the given weightstatic TermWeightortermAndFieldWeightor(double weight, Term... terms) QueryTerms with a term and field value from the selected set will be assigned the given weightstatic TermWeightortermFreqWeightor(Map<String, Integer> frequencies, double n, double k) QueryTerms will be assigned a weight based on their term frequencystatic TermWeightortermWeightor(double weight, Set<BytesRef> terms) QueryTerms with a term value from the selected set will be assigned the given weightstatic TermWeightortermWeightor(double weight, BytesRef... terms) QueryTerms with a term value from the selected set will be assigned the given weightMethods inherited from interface java.util.function.ToDoubleFunction
applyAsDouble
-
Field Details
-
DEFAULT
A default TermWeightor based on token length
-
-
Method Details
-
combine
Combine weightors by multiplication -
fieldWeightor
QueryTerms with a field from the selected set will be assigned the given weight -
fieldWeightor
QueryTerms with a field from the selected set will be assigned the given weight -
termWeightor
QueryTerms with a term value from the selected set will be assigned the given weight -
termWeightor
QueryTerms with a term value from the selected set will be assigned the given weight -
termAndFieldWeightor
QueryTerms with a term and field value from the selected set will be assigned the given weight -
termAndFieldWeightor
QueryTerms with a term and field value from the selected set will be assigned the given weight -
termFreqWeightor
QueryTerms will be assigned a weight based on their term frequencyMore infrequent terms are weighted higher. Terms are weighted according to the function
w = (n / freq) + k. Terms with no associated frequency receive a weight of value1- Parameters:
frequencies- a map of terms to frequenciesn- a scaling factork- the minimum weight to scale to
-
lengthWeightor
QueryTerms will be assigned a weight based on their term lengthWeights are assigned by the function
a * e ^ (-k * length). Longer terms are weighted higher. Terms of length greater than 32 all receive the same weight.- Parameters:
a- ak- k
-