pub trait SearchProviderImpl {
    // Required methods
    fn activate_result(
        &self,
        identifier: ResultID,
        terms: &[String],
        timestamp: u32
    );
    fn initial_result_set(&self, terms: &[String]) -> Vec<ResultID>;
    fn result_metas(&self, identifiers: &[ResultID]) -> Vec<ResultMeta>;

    // Provided methods
    fn subsearch_result_set(
        &self,
        _previous_results: &[ResultID],
        terms: &[String]
    ) -> Vec<ResultID> { ... }
    fn launch_search(&self, _terms: &[String], _timestamp: u32) { ... }
}
Expand description

A trait to implement to communicate with the search provider interface.

Required Methods§

source

fn activate_result( &self, identifier: ResultID, terms: &[String], timestamp: u32 )

The method is called when a user clicks on an individual search result to open it in the application.

Arguments
  • identifier - the result ID.
  • terms - current search terms.
  • timestamp - current timestamp.
source

fn initial_result_set(&self, terms: &[String]) -> Vec<ResultID>

The method is called when a new search is started.

Arguments
  • terms - current search terms.
  • timestamp - current timestamp.
Returns

A list of search results IDs. GNOME Shell, will call result_metas() on some of those IDs to retrieve the corresponding ResultMeta.

source

fn result_metas(&self, identifiers: &[ResultID]) -> Vec<ResultMeta>

The method is called to obtain detailed information of the results.

Arguments
  • identifiers - search result IDs.
Returns

A list of their correspoding ResultMeta, see ResultMeta::builder on how to construct one.

Provided Methods§

source

fn subsearch_result_set( &self, _previous_results: &[ResultID], terms: &[String] ) -> Vec<ResultID>

The method is called to refine the initial search results when more characters were typed in the search entry.

Arguments
  • previous_results - list of results ID returned by a previous call to initial_result_set().
  • terms - current search terms.
Returns

A list of search results IDs. GNOME Shell, will call result_metas() on some of those IDs to retrieve the corresponding ResultMeta.

By default the method calls initial_result_set().

The method is called when a user clicks on the provider icon to display more search results in the application.

Arguments
  • terms - current search terms.
  • timestamp - current timestamp.

By default the method does nothing.

Implementors§