Struct imdb_index::SearchResults
[−]
[src]
pub struct SearchResults<T>(_);
A collection of scored values, sorted in descending order by score.
Methods
impl<T> SearchResults<T>
[src]
pub fn new() -> SearchResults<T>
[src]
Create an empty collection of scored values.
pub fn from_min_heap(
queue: &mut BinaryHeap<Reverse<Scored<T>>>
) -> SearchResults<T>
[src]
queue: &mut BinaryHeap<Reverse<Scored<T>>>
) -> SearchResults<T>
Create a collection of search results from a min-heap of scored values.
pub fn push(&mut self, scored: Scored<T>)
[src]
Add a new scored value to this collection.
The score provided must be less than or equal to every other score in this collection, otherwise this method will panic.
pub fn normalize(&mut self)
[src]
Normalizes the scores in this collection such that all scores are in
the range [0, 1]
where the top result always has score 1.0
.
This operation is idempotent and does not change the ordering of results.
pub fn rescore<F: FnMut(&T) -> f64>(&mut self, rescore: F)
[src]
Recomputes the scores in this collection using the given function.
The results are then re-sorted according to the new scores.
pub fn trim(&mut self, size: usize)
[src]
Trim this collection so that it contains at most the first size
results.
pub fn len(&self) -> usize
[src]
Returns the number of results in this collection.
pub fn is_empty(&self) -> bool
[src]
Returns true if and only if this collection is empty.
pub fn as_slice(&self) -> &[Scored<T>]
[src]
Return a slice of search results in order.
pub fn into_vec(self) -> Vec<Scored<T>>
[src]
Consume this collection and return the underlying sorted sequence of scored values.
Trait Implementations
impl<T: Clone> Clone for SearchResults<T>
[src]
fn clone(&self) -> SearchResults<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Debug> Debug for SearchResults<T>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<T: Default> Default for SearchResults<T>
[src]
fn default() -> SearchResults<T>
[src]
Returns the "default value" for a type. Read more
impl<T> IntoIterator for SearchResults<T>
[src]
Auto Trait Implementations
impl<T> Send for SearchResults<T> where
T: Send,
T: Send,
impl<T> Sync for SearchResults<T> where
T: Sync,
T: Sync,