[][src]Struct imdb_index::Searcher

pub struct Searcher { /* fields omitted */ }

A handle that permits searching IMDb media records with relevance ranking.

A searcher is constructed by providing it a handle to an IMDb Index. The Index is responsible for managing the lower level data access, while the Searcher provides high level routines for ranking results.

The primary interface to a Searcher is its search method, which takes as input a Query and returns a ranked list of MediaEntity as output.

Methods

impl Searcher[src]

pub fn new(idx: Index) -> Searcher[src]

Create a new searcher for the given Index.

A single searcher can be used to execute many queries.

An existing Index can be opened with Index::open, and a new Index can be created with Index::create.

pub fn search(&mut self, query: &Query) -> Result<SearchResults<MediaEntity>>[src]

Execute a search with the given Query.

Generally, the results returned are ranked in relevance order, where each result has a score associated with it. The score is between 0 and 1.0 (inclusive), where a score of 1.0 means "most similar" and a score of 0 means "least similar."

Depending on the query, the behavior of search can vary:

  • When the query specifies a similarity function, then the results are ranked by that function.
  • When the query contains a name to search by and a name scorer, then results are ranked by the name scorer. If the query specifies a similarity function, then results are first ranked by the name scorer, and then re-ranked by the similarity function.
  • When no name or no name scorer are specified by the query, then this search will do a (slow) exhaustive search over all media records in IMDb. As a special case, if the query contains a TV show ID, then only records in that TV show are searched, and this is generally fast.
  • If the query is empty, then no results are returned.

If there was a problem reading the underlying index or the IMDb data, then an error is returned.

pub fn index(&mut self) -> &mut Index[src]

Return a mutable reference to the underlying index for this searcher.

Trait Implementations

impl Debug for Searcher[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]