Skip to main content

Ranker

Struct Ranker 

Source
pub struct Ranker { /* private fields */ }
Expand description

The rules, with how a title is compared to the query: the server compares as Plex sorts (normalized); the SDK with no server folds accents and punctuation as well, as it matches.

Implementations§

Source§

impl Ranker

Source

pub fn new(normalize: fn(&str) -> String) -> Self

Titles and the query compared after normalize, which drops a leading article as normalized does.

Source

pub fn group( &self, request: &SearchRequest, query: &Parsed, found: Vec<Matched>, totals: &HashMap<SearchKind, u32>, without_year: Vec<Item>, copies: &HashMap<MediaId, Vec<MediaId>>, ) -> SearchResults

What a client is shown of found, the matches for query (its text and the year taken off it). totals has each kind’s count, the other scopes’ too when they were counted. In All, an episode whose show is listed in the shows group (or any of that show’s other copies, copies) is quiet: counted in hidden, not listed. One whose show is the top match is listed. A group with no item is left out, but for a “See all”.

Source

pub fn without_year( &self, text: &str, year: u16, found: &[Matched], any_year: Vec<Matched>, ) -> Vec<Item>

Up to WITHOUT_YEAR of any_year that are not of year and not already found, best first.

Source

pub fn tier_of(&self, title: &str, text: &str) -> u8

0 for a title that is the query, 1 for one that starts with it, 2 for the rest. text is normalized already.

Trait Implementations§

Source§

impl Clone for Ranker

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Ranker

Source§

impl Debug for Ranker

Source§

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

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

impl Default for Ranker

Source§

fn default() -> Self

Titles compared normalized: the server’s.

Auto Trait Implementations§

§

impl Forget for Ranker

§

impl Freeze for Ranker

§

impl Move for Ranker

§

impl RefUnwindSafe for Ranker

§

impl Send for Ranker

§

impl Sync for Ranker

§

impl Unpin for Ranker

§

impl UnsafeUnpin for Ranker

§

impl UnwindSafe for Ranker

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.