use crate::document::Document;
use crate::error::Result;
use crate::query::{Hit, Query};
use async_trait::async_trait;
#[derive(Debug, Clone)]
pub struct IndexDoc {
pub id: String,
pub document: Document,
}
#[async_trait]
pub trait Backend: Send + Sync {
async fn upsert(&self, index: &str, docs: Vec<IndexDoc>) -> Result<()>;
async fn delete(&self, index: &str, ids: &[String]) -> Result<()>;
async fn search(&self, index: &str, query: &Query) -> Result<Vec<Hit>>;
async fn clear(&self, index: &str) -> Result<()>;
async fn count(&self, index: &str) -> Result<usize>;
}