use serde::{Deserialize, Serialize};
use std::error::Error as StdError;
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct IngestDoc {
pub external_id: String,
pub label: String,
pub text: String,
pub props: serde_json::Map<String, serde_json::Value>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Hit {
pub external_id: String,
pub score: f32,
}
pub trait BenchAdapter {
fn reset(&mut self) -> Result<(), Box<dyn StdError>>;
fn ingest(&mut self, docs: &[IngestDoc]) -> Result<(), Box<dyn StdError>>;
fn retrieve(
&mut self,
label: &str,
query: &str,
top_k: usize,
) -> Result<Vec<Hit>, Box<dyn StdError>>;
fn name(&self) -> &str;
}