pub trait RetrievalHook: Send + Sync {
// Provided methods
fn before_retrieve(&self, _request: &mut RetrievalRequest) { ... }
fn after_retrieve(
&self,
_request: &RetrievalRequest,
_names: &mut Vec<String>,
) { ... }
}Expand description
A look at the question before it is asked, and the answer before it is used.
Both halves are useful for the same reason and in opposite directions: a deployment knows things about its own vocabulary that the retriever does not (expand an acronym, add the current file’s name), and knows things about its own policy that the retriever should not have to (drop anything from a scope this session must not see).
Provided Methods§
Sourcefn before_retrieve(&self, _request: &mut RetrievalRequest)
fn before_retrieve(&self, _request: &mut RetrievalRequest)
Change the question. The default does nothing.
Sourcefn after_retrieve(&self, _request: &RetrievalRequest, _names: &mut Vec<String>)
fn after_retrieve(&self, _request: &RetrievalRequest, _names: &mut Vec<String>)
Change the answer — filter, reorder, truncate. The default does nothing.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".