milli_core/update/
update_step.rs

1use UpdateIndexingStep::*;
2
3#[derive(Debug, Clone, Copy)]
4pub enum UpdateIndexingStep {
5    /// Remap document addition fields the one present in the database, adding new fields in to the
6    /// schema on the go.
7    RemapDocumentAddition { documents_seen: usize },
8
9    /// This step check the external document id, computes the internal ids and merge
10    /// the documents that are already present in the database.
11    ComputeIdsAndMergeDocuments { documents_seen: usize, total_documents: usize },
12
13    /// Extract the documents words using the tokenizer and compute the documents
14    /// facets. Stores those words, facets and documents ids on disk.
15    IndexDocuments { documents_seen: usize, total_documents: usize },
16
17    /// Merge the previously extracted data (words and facets) into the final LMDB database.
18    /// These extracted data are split into multiple databases.
19    MergeDataIntoFinalDatabase { databases_seen: usize, total_databases: usize },
20}
21
22impl UpdateIndexingStep {
23    pub const fn step(&self) -> usize {
24        match self {
25            RemapDocumentAddition { .. } => 0,
26            ComputeIdsAndMergeDocuments { .. } => 1,
27            IndexDocuments { .. } => 2,
28            MergeDataIntoFinalDatabase { .. } => 3,
29        }
30    }
31
32    pub const fn number_of_steps(&self) -> usize {
33        4
34    }
35}