summa_core/segment/builder/
config.rs1use std::path::PathBuf;
4
5use crate::compression::CompressionLevel;
6
7#[derive(Debug, Clone, Default)]
9pub struct SegmentBuilderStats {
10 pub num_docs: u32,
12 pub unique_terms: usize,
14 pub postings_in_memory: usize,
16 pub interned_strings: usize,
18 pub doc_field_lengths_size: usize,
20 pub estimated_memory_bytes: usize,
22 pub memory_breakdown: MemoryBreakdown,
24 pub unhinted_dynamic_docs: u64,
28}
29
30#[derive(Debug, Clone, Default)]
32pub struct MemoryBreakdown {
33 pub postings_bytes: usize,
35 pub index_overhead_bytes: usize,
37 pub interner_bytes: usize,
39 pub field_lengths_bytes: usize,
41 pub dense_vectors_bytes: usize,
43 pub dense_vector_count: usize,
45 pub sparse_vectors_bytes: usize,
47 pub position_index_bytes: usize,
49}
50
51#[derive(Clone)]
53pub struct SegmentBuilderConfig {
54 pub temp_dir: PathBuf,
56 pub compression_level: CompressionLevel,
58 pub num_compression_threads: usize,
61 pub interner_capacity: usize,
63 pub posting_map_capacity: usize,
65 pub optimization: crate::structures::IndexOptimization,
68 pub posting_codec: crate::structures::PostingCodec,
70 pub quantized_norms: bool,
72 pub compact_text: bool,
74 pub posting_ratio_bounds: bool,
76 pub posting_impact_bounds: bool,
78 pub term_dict_block_size: crate::structures::SSTableBlockSize,
80}
81
82impl SegmentBuilderConfig {
83 pub fn effective_posting_bounds(&self) -> crate::index::PostingBounds {
85 crate::index::PostingBounds::new(self.posting_ratio_bounds, self.posting_impact_bounds)
86 }
87}
88
89impl Default for SegmentBuilderConfig {
90 fn default() -> Self {
91 Self {
92 #[cfg(feature = "native")]
93 temp_dir: std::env::temp_dir(),
94 #[cfg(not(feature = "native"))]
95 temp_dir: PathBuf::from("/tmp"),
96 compression_level: CompressionLevel(3),
97 #[cfg(feature = "native")]
98 num_compression_threads: crate::default_compression_threads(),
99 #[cfg(not(feature = "native"))]
100 num_compression_threads: 1,
101 interner_capacity: 1_000_000,
102 posting_map_capacity: 500_000,
103 optimization: crate::structures::IndexOptimization::default(),
104 posting_codec: crate::structures::PostingCodec::default(),
105 quantized_norms: false,
106 compact_text: false,
107 posting_ratio_bounds: false,
108 posting_impact_bounds: false,
109 term_dict_block_size: crate::structures::SSTableBlockSize::default(),
110 }
111 }
112}