pub trait OutputPlugin: Send + Sync {
// Required method
fn process(
&self,
output: &mut Value,
result: &Result<(SearchAppResult, SearchInstance), CompassAppError>,
) -> Result<(), OutputPluginError>;
}Expand description
Performs some kind of post-processing on a search result. The result JSON is available to the plugin as a reference which was potentially modified upstream by another output plugin. The plugin will output a modified version of the JSON as a result.
A simple No-operation OutputPlugin would simply clone its JSON argument.
§Default OutputPlugins
The following default set of output plugin builders are found in the super::default module:
Required Methods§
Sourcefn process(
&self,
output: &mut Value,
result: &Result<(SearchAppResult, SearchInstance), CompassAppError>,
) -> Result<(), OutputPluginError>
fn process( &self, output: &mut Value, result: &Result<(SearchAppResult, SearchInstance), CompassAppError>, ) -> Result<(), OutputPluginError>
Applies this OutputPlugin to a search result, passing along a JSON
that will replace the output JSON argument.
§Arguments
output- the search result passed to this pluginresult- the result of the search via the internal representation. this is passed as aResultas the search may have failed.
§Returns
The modified JSON or an error