2020-11-11 12:16:01 +01:00
|
|
|
use UpdateIndexingStep::*;
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Copy)]
|
|
|
|
pub enum UpdateIndexingStep {
|
2021-08-31 11:44:15 +02:00
|
|
|
/// Remap document addition fields the one present in the database, adding new fields in to the
|
|
|
|
/// schema on the go.
|
|
|
|
RemapDocumentAddition { documents_seen: usize },
|
2020-11-11 12:16:01 +01:00
|
|
|
|
|
|
|
/// This step check the external document id, computes the internal ids and merge
|
|
|
|
/// the documents that are already present in the database.
|
|
|
|
ComputeIdsAndMergeDocuments { documents_seen: usize, total_documents: usize },
|
|
|
|
|
|
|
|
/// Extract the documents words using the tokenizer and compute the documents
|
|
|
|
/// facets. Stores those words, facets and documents ids on disk.
|
|
|
|
IndexDocuments { documents_seen: usize, total_documents: usize },
|
|
|
|
|
|
|
|
/// Merge the previously extracted data (words and facets) into the final LMDB database.
|
|
|
|
/// These extracted data are split into multiple databases.
|
|
|
|
MergeDataIntoFinalDatabase { databases_seen: usize, total_databases: usize },
|
|
|
|
}
|
|
|
|
|
|
|
|
impl UpdateIndexingStep {
|
2020-11-11 12:39:09 +01:00
|
|
|
pub const fn step(&self) -> usize {
|
2020-11-11 12:16:01 +01:00
|
|
|
match self {
|
2021-08-31 11:44:15 +02:00
|
|
|
RemapDocumentAddition { .. } => 0,
|
2020-11-11 12:16:01 +01:00
|
|
|
ComputeIdsAndMergeDocuments { .. } => 1,
|
|
|
|
IndexDocuments { .. } => 2,
|
|
|
|
MergeDataIntoFinalDatabase { .. } => 3,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub const fn number_of_steps(&self) -> usize {
|
|
|
|
4
|
|
|
|
}
|
|
|
|
}
|