Struct elasticsearch_dsl::search::queries::params::FieldValueFactor
source · [−]pub struct FieldValueFactor { /* private fields */ }Expand description
The field_value_factor function allows you to use a field from a document to influence the
score.
It’s similar to using the script_score function, however, it avoids the overhead of scripting.
If used on a multi-valued field, only the first value of the field is used in calculations.
As an example, imagine you have a document indexed with a numeric my-int field and wish to
influence the score of a document with this field, an example doing so would look like:
FieldValueFactor::new("my-int")
.factor(1.2)
.modifier(FieldValueFactorModifier::Sqrt)
.missing(1.0)Which will translate into the following formula for scoring:
sqrt(1.2 * doc['my-int'].value)Implementations
sourceimpl FieldValueFactor
impl FieldValueFactor
sourcepub fn new<T>(field: T) -> Selfwhere
T: ToString,
pub fn new<T>(field: T) -> Selfwhere
T: ToString,
Creates an instance of FieldValueFactor
field- Field to be extracted from the document.
sourcepub fn modifier(self, modifier: FieldValueFactorModifier) -> Self
pub fn modifier(self, modifier: FieldValueFactorModifier) -> Self
Modifier to apply to the field value
Trait Implementations
sourceimpl Clone for FieldValueFactor
impl Clone for FieldValueFactor
sourcefn clone(&self) -> FieldValueFactor
fn clone(&self) -> FieldValueFactor
Returns a copy of the value. Read more
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresourceimpl Debug for FieldValueFactor
impl Debug for FieldValueFactor
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<FieldValueFactor> for Option<Function>
impl From<FieldValueFactor> for Option<Function>
sourcefn from(q: FieldValueFactor) -> Self
fn from(q: FieldValueFactor) -> Self
Converts to this type from the input type.
sourceimpl PartialEq<FieldValueFactor> for FieldValueFactor
impl PartialEq<FieldValueFactor> for FieldValueFactor
sourcefn eq(&self, other: &FieldValueFactor) -> bool
fn eq(&self, other: &FieldValueFactor) -> bool
sourceimpl Serialize for FieldValueFactor
impl Serialize for FieldValueFactor
impl StructuralPartialEq for FieldValueFactor
Auto Trait Implementations
impl RefUnwindSafe for FieldValueFactor
impl Send for FieldValueFactor
impl Sync for FieldValueFactor
impl Unpin for FieldValueFactor
impl UnwindSafe for FieldValueFactor
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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