Skip to main content

ix_core/
index.rs

1use anyhow::Result;
2
3use crate::entity::EntityKind;
4use crate::repo::IxchelRepo;
5
6#[derive(Debug, Default, Clone, Copy)]
7pub struct SyncStats {
8    pub scanned: u32,
9    pub added: u32,
10    pub modified: u32,
11    pub deleted: u32,
12    pub unchanged: u32,
13}
14
15#[derive(Debug, Clone)]
16pub struct SearchHit {
17    pub score: f32,
18    pub id: String,
19    pub kind: Option<EntityKind>,
20    pub title: String,
21}
22
23pub trait IndexBackend: Send + Sync {
24    fn sync(&mut self, repo: &IxchelRepo) -> Result<SyncStats>;
25    fn search(&self, query: &str, limit: usize) -> Result<Vec<SearchHit>>;
26    fn health_check(&self) -> Result<()>;
27}