Struct elasticsearch_dsl::search::queries::params::RandomScore
source · [−]pub struct RandomScore { /* private fields */ }
Expand description
The random_score
generates scores that are uniformly distributed from 0
up to but not
including 1
.
By default, it uses the internal Lucene doc ids as a source of randomness, which is very efficient but unfortunately not reproducible since documents might be renumbered by merges.
In case you want scores to be reproducible, it is possible to provide a seed
and field
. The
final score will then be computed based on this seed, the minimum value of field
for the
considered document and a salt that is computed based on the index name and shard id so that
documents that have the same value but are stored in different indexes get different scores.
Note that documents that are within the same shard and have the same value for field
will
however get the same score, so it is usually desirable to use a field that has unique values
for all documents. A good default choice might be to use the _seq_no
field, whose only
drawback is that scores will change if the document is updated since update operations also
update the value of the _seq_no
field.
Implementations
Trait Implementations
sourceimpl Clone for RandomScore
impl Clone for RandomScore
sourcefn clone(&self) -> RandomScore
fn clone(&self) -> RandomScore
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for RandomScore
impl Debug for RandomScore
sourceimpl Default for RandomScore
impl Default for RandomScore
sourcefn default() -> RandomScore
fn default() -> RandomScore
Returns the “default value” for a type. Read more
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.
sourceimpl From<RandomScore> for Option<Function>
impl From<RandomScore> for Option<Function>
sourcefn from(q: RandomScore) -> Self
fn from(q: RandomScore) -> Self
Converts to this type from the input type.
sourceimpl PartialEq<RandomScore> for RandomScore
impl PartialEq<RandomScore> for RandomScore
sourcefn eq(&self, other: &RandomScore) -> bool
fn eq(&self, other: &RandomScore) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &RandomScore) -> bool
fn ne(&self, other: &RandomScore) -> bool
This method tests for !=
.
sourceimpl Serialize for RandomScore
impl Serialize for RandomScore
impl StructuralPartialEq for RandomScore
Auto Trait Implementations
impl RefUnwindSafe for RandomScore
impl Send for RandomScore
impl Sync for RandomScore
impl Unpin for RandomScore
impl UnwindSafe for RandomScore
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