pub enum Function {
Show 14 variants
Weight(Weight),
RandomScore(RandomScore),
FieldValueFactor(FieldValueFactor),
DecayDateTime(Decay<DateTime<Utc>>),
DecayLocation(Decay<GeoPoint>),
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<GeoPoint>)
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
sourceimpl Function
impl Function
sourcepub fn random_score() -> RandomScore
pub fn random_score() -> RandomScore
Creates an instance of RandomScore
sourcepub fn field_value_factor(field: impl Into<String>) -> FieldValueFactor
pub fn field_value_factor(field: impl Into<String>) -> FieldValueFactor
Creates an instance of FieldValueFactor
field
- Field to be extracted from the document.
sourcepub fn decay<T: Origin>(
function: DecayFunction,
field: impl Into<String>,
origin: T,
scale: <T as Origin>::Scale
) -> Decay<T>
pub fn decay<T: Origin>(
function: DecayFunction,
field: impl Into<String>,
origin: T,
scale: <T as Origin>::Scale
) -> Decay<T>
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
sourceimpl From<FieldValueFactor> for Function
impl From<FieldValueFactor> for Function
sourcefn from(q: FieldValueFactor) -> Self
fn from(q: FieldValueFactor) -> Self
Converts to this type from the input type.
sourceimpl From<RandomScore> for Function
impl From<RandomScore> for Function
sourcefn from(q: RandomScore) -> Self
fn from(q: RandomScore) -> Self
Converts to this type from the input type.
impl StructuralPartialEq for Function
Auto Trait Implementations
impl RefUnwindSafe for Function
impl Send for Function
impl Sync for Function
impl Unpin for Function
impl UnwindSafe for Function
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more