pub trait Indexer: Send + Sync {
// Required methods
fn index<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
index: &'life1 str,
id: &'life2 str,
document: Map<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn remove<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
index: &'life1 str,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
index: &'life1 str,
query: &'life2 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
A pluggable search index. Keyed by index (a resource’s base_path()), so
one backend serves every searchable resource. Async — it does I/O, once per
mutation, not per request.
Required Methods§
Sourcefn index<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
index: &'life1 str,
id: &'life2 str,
document: Map<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn index<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
index: &'life1 str,
id: &'life2 str,
document: Map<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Insert or replace the document for one record.
Sourcefn remove<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
index: &'life1 str,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn remove<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
index: &'life1 str,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Remove a record from the index.
Sourcefn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
index: &'life1 str,
query: &'life2 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
index: &'life1 str,
query: &'life2 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Full-text search, returning matching record ids in rank order (best first). The caller hydrates the rows from storage.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".