1use std::io;
4
5#[derive(Debug, thiserror::Error)]
6pub enum Error {
7 #[error("IO error: {0}")]
8 Io(#[from] io::Error),
9
10 #[error("Field not found: {0}")]
11 FieldNotFound(String),
12
13 #[error("Invalid field type: expected {expected}, got {got}")]
14 InvalidFieldType { expected: String, got: String },
15
16 #[error("Index corruption: {0}")]
17 Corruption(String),
18
19 #[error("Serialization error: {0}")]
20 Serialization(String),
21
22 #[error("Index is closed")]
23 IndexClosed,
24
25 #[error("Document not found: {0}")]
26 DocumentNotFound(u32),
27
28 #[error("Schema error: {0}")]
29 Schema(String),
30
31 #[error("Query error: {0}")]
32 Query(String),
33
34 #[error("Indexing queue full — apply backpressure")]
35 QueueFull,
36
37 #[error("Commit is still finalizing or awaiting retry")]
38 CommitInProgress,
39
40 #[error(
41 "Commit flush timed out: {flushed_workers}/{total_workers} workers flushed; writer remains paused, retry commit"
42 )]
43 CommitFlushTimeout {
44 flushed_workers: usize,
45 total_workers: usize,
46 },
47
48 #[error("Internal error: {0}")]
49 Internal(String),
50
51 #[error("Document error: {0}")]
52 Document(String),
53
54 #[error("Tokenizer error: {0}")]
55 Tokenizer(String),
56
57 #[error("Duplicate primary key: {0}")]
58 DuplicatePrimaryKey(String),
59}
60
61pub type Result<T> = std::result::Result<T, Error>;