public interface TermWeightor extends ToDoubleFunction<Term>
Term
Modifier and Type | Field and Description |
---|---|
static TermWeightor |
DEFAULT
A default TermWeightor based on token length
|
Modifier and Type | Method and Description |
---|---|
static TermWeightor |
combine(TermWeightor... weightors)
Combine weightors by multiplication
|
static TermWeightor |
fieldWeightor(double weight,
Set<String> fields)
QueryTerms with a field from the selected set will be assigned the given weight
|
static TermWeightor |
fieldWeightor(double weight,
String... fields)
QueryTerms with a field from the selected set will be assigned the given weight
|
static TermWeightor |
lengthWeightor(double a,
double k)
QueryTerms will be assigned a weight based on their term length
Weights are assigned by the function
a * e ^ (-k * length) . |
static TermWeightor |
termAndFieldWeightor(double weight,
Set<Term> terms)
QueryTerms with a term and field value from the selected set will be assigned the given weight
|
static TermWeightor |
termAndFieldWeightor(double weight,
Term... terms)
QueryTerms with a term and field value from the selected set will be assigned the given weight
|
static TermWeightor |
termFreqWeightor(Map<String,Integer> frequencies,
double n,
double k)
QueryTerms will be assigned a weight based on their term frequency
More infrequent terms are weighted higher.
|
static TermWeightor |
termWeightor(double weight,
BytesRef... terms)
QueryTerms with a term value from the selected set will be assigned the given weight
|
static TermWeightor |
termWeightor(double weight,
Set<BytesRef> terms)
QueryTerms with a term value from the selected set will be assigned the given weight
|
applyAsDouble
static final TermWeightor DEFAULT
static TermWeightor combine(TermWeightor... weightors)
static TermWeightor fieldWeightor(double weight, Set<String> fields)
static TermWeightor fieldWeightor(double weight, String... fields)
static TermWeightor termWeightor(double weight, Set<BytesRef> terms)
static TermWeightor termWeightor(double weight, BytesRef... terms)
static TermWeightor termAndFieldWeightor(double weight, Set<Term> terms)
static TermWeightor termAndFieldWeightor(double weight, Term... terms)
static TermWeightor termFreqWeightor(Map<String,Integer> frequencies, double n, double k)
w = (n / freq) + k
. Terms with no associated
frequency receive a weight of value 1
frequencies
- a map of terms to frequenciesn
- a scaling factork
- the minimum weight to scale tostatic TermWeightor lengthWeightor(double a, double k)
a * e ^ (-k * length)
. Longer
terms are weighted higher. Terms of length greater than 32 all receive the
same weight.a
- ak
- kCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.