pub struct SearchResults<T = Item> {
pub top: Option<TopResult<T>>,
pub groups: Vec<SearchGroup<T>>,
pub counts: SearchCounts,
pub year: Option<u16>,
pub without_year: Vec<T>,
}Expand description
What a search found: Items, or for a client that names the
experimental federation feature SearchHits.
Fields§
§top: Option<TopResult<T>>The single best match: an exact title, else a title that starts
with the query (case and a leading “the”, “a” or “an” aside), else
the first result; on a tie a show before a movie, then artist,
album, track and episode, so a show beats its own episodes. A
person is the top match only when their name matches better than
every title (an exact “keanu reeves” over titles that start with
it), or when only people are found: on a tie the item wins. Not
repeated in its group. None for a kind search.
groups: Vec<SearchGroup<T>>The groups that have something to show, in the order they are
shown: shows, movies, people, artists, albums, tracks, episodes. A
kind search has that one group, even when it is empty.
counts: SearchCounts§year: Option<u16>The year taken from the end of the query as a filter, to show as a removable token.
without_year: Vec<T>With a year: up to 3 items the query matches in other years, for
“also matching without the year”.
Implementations§
Source§impl<T> SearchResults<T>
impl<T> SearchResults<T>
Sourcepub fn map<U>(self, f: impl FnMut(T) -> U) -> SearchResults<U>
pub fn map<U>(self, f: impl FnMut(T) -> U) -> SearchResults<U>
The same results with each item made f of it, in place.
Source§impl<T> SearchResults<T>
impl<T> SearchResults<T>
Sourcepub fn see_all_count(&self, kind: SearchKind) -> Option<u32>
pub fn see_all_count(&self, kind: SearchKind) -> Option<u32>
The number “See all” names for kind’s group: its own total, else
its scope’s count. None when the group has no more to show, or
nothing says how many: then a plain “See all”.
Source§impl SearchResults<SearchResult>
impl SearchResults<SearchResult>
The episodes kind‘s group left under their show, with the shows’
titles (the top match’s too); None when none were.
Sourcepub fn only_from(self, origin: Option<&str>) -> Self
pub fn only_from(self, origin: Option<&str>) -> Self
Only the hits from paired server origin (its server id), or the
user’s own with None, for a server’s chip. People are the user’s
own server’s, so only it keeps them. The counts are what is left:
all counts the people kept too. A group’s total is its items
left when it had no more to show, else not known. Episodes hidden
under their show stay hidden only while a show is left to hold
them.