InputPlugin

Trait InputPlugin 

Source
pub trait InputPlugin: Send + Sync {
    // Required method
    fn process(
        &self,
        input: &mut Value,
        search_app: Arc<SearchApp>,
    ) -> Result<(), InputPluginError>;
}
Expand description

Performs some kind of pre-processing on a user query input. The input JSON is available to the plugin as a reference. The plugin produces a vector of zero to many JSON objects that will replace the input JSON.

A simple No-operation InputPlugin would simply clone the input and place it in a Vec.

§Default InputPlugins

The following default set of input plugin builders are found in the super::default module:

  • debug - logs the (current) status of each query to the logging system
  • grid search - duplicates a query based on a list of user-defined values
  • inject - mechanism to inject values into the queries
  • load balancer - uses weighting heuristics to balance query loads across threads

Required Methods§

Source

fn process( &self, input: &mut Value, search_app: Arc<SearchApp>, ) -> Result<(), InputPluginError>

Applies this InputPlugin to a user query input, passing along a Vec of input queries as a result which will replace the input.

§Arguments
  • input - the user query input passed to this plugin
  • search_app - a reference to the search app with all loaded assets
§Returns

A Vec of JSON values to replace the input JSON, or an error

Implementors§