pub enum Function {
Show 14 variants
Weight(Weight),
RandomScore(RandomScore),
FieldValueFactor(FieldValueFactor),
DecayDateTime(Decay<DateTime<Utc>>),
DecayLocation(Decay<GeoLocation>),
DecayI8(Decay<i8>),
DecayI16(Decay<i16>),
DecayI32(Decay<i32>),
DecayI64(Decay<i64>),
DecayU8(Decay<u8>),
DecayU16(Decay<u16>),
DecayU32(Decay<u32>),
DecayU64(Decay<u64>),
Script(Script),
}
Expand description
Functions available for use in FunctionScoreQuery
Variants§
Weight(Weight)
RandomScore(RandomScore)
FieldValueFactor(FieldValueFactor)
DecayDateTime(Decay<DateTime<Utc>>)
DecayLocation(Decay<GeoLocation>)
DecayI8(Decay<i8>)
DecayI16(Decay<i16>)
DecayI32(Decay<i32>)
DecayI64(Decay<i64>)
DecayU8(Decay<u8>)
DecayU16(Decay<u16>)
DecayU32(Decay<u32>)
DecayU64(Decay<u64>)
Script(Script)
Implementations§
source§impl Function
impl Function
sourcepub fn random_score() -> RandomScore
pub fn random_score() -> RandomScore
Creates an instance of RandomScore
sourcepub fn field_value_factor<T>(field: T) -> FieldValueFactorwhere
T: ToString,
pub fn field_value_factor<T>(field: T) -> FieldValueFactorwhere
T: ToString,
Creates an instance of FieldValueFactor
field
- Field to be extracted from the document.
sourcepub fn decay<T, O>(
function: DecayFunction,
field: T,
origin: O,
scale: <O as Origin>::Scale
) -> Decay<O>where
T: ToString,
O: Origin,
pub fn decay<T, O>(
function: DecayFunction,
field: T,
origin: O,
scale: <O as Origin>::Scale
) -> Decay<O>where
T: ToString,
O: Origin,
Creates an instance of Decay
function
- Decay function variantfield
- Field to apply function toorigin
- The point of origin used for calculating distance. Must be given as a number for numeric field, date for date fields and geo point for geo fields. Required for geo and numeric field. For date fields the default isnow
. Date math (for example now-1h) is supported for origin.scale
- Required for all types. Defines the distance from origin + offset at which the computed score will equaldecay
parameter. For geo fields: Can be defined as number+unit (1km, 12m,…). Default unit is meters. For date fields: Can to be defined as a number+unit (“1h”, “10d”,…). Default unit is milliseconds. For numeric field: Any number.
Trait Implementations§
source§impl From<Decay<GeoLocation>> for Function
impl From<Decay<GeoLocation>> for Function
source§fn from(q: Decay<GeoLocation>) -> Self
fn from(q: Decay<GeoLocation>) -> Self
Converts to this type from the input type.
source§impl From<FieldValueFactor> for Function
impl From<FieldValueFactor> for Function
source§fn from(q: FieldValueFactor) -> Self
fn from(q: FieldValueFactor) -> Self
Converts to this type from the input type.
source§impl From<RandomScore> for Function
impl From<RandomScore> for Function
source§fn from(q: RandomScore) -> Self
fn from(q: RandomScore) -> Self
Converts to this type from the input type.