use thiserror::Error;
pub type BoxError = Box<dyn std::error::Error + Send + Sync>;
#[derive(Error, Debug)]
pub enum BM25Error {
#[error("BM25 index {name:?}, error: {source:?}")]
Generic {
name: String,
source: BoxError,
},
#[error("BM25 index {name:?}, CBOR serialization error: {source:?}")]
Serialization {
name: String,
source: BoxError,
},
#[error("BM25 index {name:?}, document {id} not found")]
NotFound {
name: String,
id: u64,
},
#[error("BM25 index {name:?}, document {id} already exists")]
AlreadyExists {
name: String,
id: u64,
},
#[error("BM25 index {name:?}, document {id} tokenization failed: {text:?}")]
TokenizeFailed {
name: String,
id: u64,
text: String,
},
}