pub enum Function {
Show 16 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>),
DecayF32(Decay<f32>),
DecayF64(Decay<f64>),
ScriptScore(ScriptScore),
}
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>)
DecayF32(Decay<f32>)
DecayF64(Decay<f64>)
ScriptScore(ScriptScore)
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.
Sourcepub fn script(source: Script) -> ScriptScore
pub fn script(source: Script) -> ScriptScore
Creates an instance of script
source
- script source
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.
Source§impl From<ScriptScore> for Function
impl From<ScriptScore> for Function
Source§fn from(q: ScriptScore) -> Self
fn from(q: ScriptScore) -> Self
Converts to this type from the input type.
impl StructuralPartialEq for Function
Auto Trait Implementations§
impl Freeze for Function
impl RefUnwindSafe for Function
impl Send for Function
impl Sync for Function
impl Unpin for Function
impl UnwindSafe for Function
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more