Enum Function

Source
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

Source

pub fn weight(weight: f32) -> Weight

Creates an instance of Weight

Source

pub fn random_score() -> RandomScore

Creates an instance of RandomScore

Source

pub fn field_value_factor<T>(field: T) -> FieldValueFactor
where T: ToString,

Creates an instance of FieldValueFactor

  • field - Field to be extracted from the document.
Source

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 variant
  • field - Field to apply function to
  • origin - 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 is now. 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 equal decay 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.
Source

pub fn script(source: Script) -> ScriptScore

Creates an instance of script

  • source - script source

Trait Implementations§

Source§

impl Clone for Function

Source§

fn clone(&self) -> Function

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Function

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Decay<DateTime<Utc>>> for Function

Source§

fn from(q: Decay<DateTime<Utc>>) -> Self

Converts to this type from the input type.
Source§

impl From<Decay<GeoLocation>> for Function

Source§

fn from(q: Decay<GeoLocation>) -> Self

Converts to this type from the input type.
Source§

impl From<Decay<f32>> for Function

Source§

fn from(q: Decay<f32>) -> Self

Converts to this type from the input type.
Source§

impl From<Decay<f64>> for Function

Source§

fn from(q: Decay<f64>) -> Self

Converts to this type from the input type.
Source§

impl From<Decay<i16>> for Function

Source§

fn from(q: Decay<i16>) -> Self

Converts to this type from the input type.
Source§

impl From<Decay<i32>> for Function

Source§

fn from(q: Decay<i32>) -> Self

Converts to this type from the input type.
Source§

impl From<Decay<i64>> for Function

Source§

fn from(q: Decay<i64>) -> Self

Converts to this type from the input type.
Source§

impl From<Decay<i8>> for Function

Source§

fn from(q: Decay<i8>) -> Self

Converts to this type from the input type.
Source§

impl From<Decay<u16>> for Function

Source§

fn from(q: Decay<u16>) -> Self

Converts to this type from the input type.
Source§

impl From<Decay<u32>> for Function

Source§

fn from(q: Decay<u32>) -> Self

Converts to this type from the input type.
Source§

impl From<Decay<u64>> for Function

Source§

fn from(q: Decay<u64>) -> Self

Converts to this type from the input type.
Source§

impl From<Decay<u8>> for Function

Source§

fn from(q: Decay<u8>) -> Self

Converts to this type from the input type.
Source§

impl From<FieldValueFactor> for Function

Source§

fn from(q: FieldValueFactor) -> Self

Converts to this type from the input type.
Source§

impl From<RandomScore> for Function

Source§

fn from(q: RandomScore) -> Self

Converts to this type from the input type.
Source§

impl From<ScriptScore> for Function

Source§

fn from(q: ScriptScore) -> Self

Converts to this type from the input type.
Source§

impl From<Weight> for Function

Source§

fn from(q: Weight) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Function

Source§

fn eq(&self, other: &Function) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Function

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Function

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.