pub trait SuggestionProvider: Send + Sync {
    fn name(&self) -> String;
    fn suggest<'life0, 'async_trait>(
        &'life0 self,
        query: SuggestionRequest
    ) -> Pin<Box<dyn Future<Output = Result<SuggestionResponse, SuggestError>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn reconfigure<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        new_config: Value,
        make_fresh: &'life1 MakeFreshType
    ) -> Pin<Box<dyn Future<Output = Result<(), SetupError>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
; fn is_null(&self) -> bool { ... } fn cache_inputs(
        &self,
        req: &SuggestionRequest,
        cache_inputs: &mut dyn CacheInputs
    ) { ... } fn cache_key(&self, req: &SuggestionRequest) -> String { ... } }
Expand description

A backend that can provide suggestions for queries.

Required Methods

An operator-visible name for this suggestion provider.

Provide suggested results for query.

Reconfigure the provider, using a new configuration object. State should be preserved if possible.

The parameter make_fresh can be used to make a new provider from a configuration, such as if a inner provider must be thrown away and recreated.

Provided Methods

Return if this provider is null and can be ignored. Providers that set this to true should be ignored in any place where suggestions are needed. Providers with this set to true likely only serve as a blank space where we may need a provider but can’t otherwise supply one.

Generate a set of cache inputs for a given query specific to this provider. Any property of the query that affects how suggestions are generated should be included.

By default, all properties of the query are used, but providers should narrow this to a smaller scope.

Use Self::cache_inputs to generate a single cache key. This function should not normally be overridden by provider implementations.

Implementors