use std::path::PathBuf;
use crate::compression::CompressionLevel;
#[derive(Debug, Clone, Default)]
pub struct SegmentBuilderStats {
pub num_docs: u32,
pub unique_terms: usize,
pub postings_in_memory: usize,
pub interned_strings: usize,
pub doc_field_lengths_size: usize,
pub estimated_memory_bytes: usize,
pub memory_breakdown: MemoryBreakdown,
}
#[derive(Debug, Clone, Default)]
pub struct MemoryBreakdown {
pub postings_bytes: usize,
pub index_overhead_bytes: usize,
pub interner_bytes: usize,
pub field_lengths_bytes: usize,
pub dense_vectors_bytes: usize,
pub dense_vector_count: usize,
pub sparse_vectors_bytes: usize,
pub position_index_bytes: usize,
}
#[derive(Clone)]
pub struct SegmentBuilderConfig {
pub temp_dir: PathBuf,
pub compression_level: CompressionLevel,
pub num_compression_threads: usize,
pub interner_capacity: usize,
pub posting_map_capacity: usize,
}
impl Default for SegmentBuilderConfig {
fn default() -> Self {
Self {
#[cfg(feature = "native")]
temp_dir: std::env::temp_dir(),
#[cfg(not(feature = "native"))]
temp_dir: PathBuf::from("/tmp"),
compression_level: CompressionLevel(3),
#[cfg(feature = "native")]
num_compression_threads: crate::default_compression_threads(),
#[cfg(not(feature = "native"))]
num_compression_threads: 1,
interner_capacity: 1_000_000,
posting_map_capacity: 500_000,
}
}
}