diff --git a/src/indexer/index_writer.rs b/src/indexer/index_writer.rs index 2de45d412..165e090fa 100644 --- a/src/indexer/index_writer.rs +++ b/src/indexer/index_writer.rs @@ -66,7 +66,7 @@ impl IndexWriter { let document_receiver_clone = self.document_receiver.clone(); let target_num_docs = self.target_num_docs; let join_handle: JoinHandle<()> = thread::spawn(move || { - let mut block_store = BlockStore::allocate(100_000); + let mut block_store = BlockStore::allocate(500_000); loop { let segment = index.new_segment(); let segment_id = segment.id(); diff --git a/src/postings/block_store.rs b/src/postings/block_store.rs index 872f695a7..76ca90d7a 100644 --- a/src/postings/block_store.rs +++ b/src/postings/block_store.rs @@ -1,6 +1,4 @@ -use compression::NUM_DOCS_PER_BLOCK; - -pub const BLOCK_SIZE: u32 = NUM_DOCS_PER_BLOCK as u32; +pub const BLOCK_SIZE: u32 = 64u32; struct Block { data: [u32; BLOCK_SIZE as usize], @@ -32,7 +30,7 @@ pub struct BlockStore { impl BlockStore { pub fn allocate(num_blocks: usize) -> BlockStore { BlockStore { - lists: Vec::with_capacity(100_000), + lists: Vec::with_capacity(num_blocks), blocks: (0 .. num_blocks).map(|_| Block::new()).collect(), free_block_id: 0, } @@ -149,7 +147,7 @@ mod tests { #[test] pub fn test_block_store() { - let mut block_store = BlockStore::allocate(1_000); + let mut block_store = BlockStore::allocate(50_000); let list_2 = block_store.new_list(); let list_3 = block_store.new_list(); let list_4 = block_store.new_list(); diff --git a/src/postings/mod.rs b/src/postings/mod.rs index c675e6f54..bd3e75a80 100644 --- a/src/postings/mod.rs +++ b/src/postings/mod.rs @@ -72,7 +72,7 @@ mod tests { let schema = schema_builder.build(); let index = Index::create_in_ram(schema.clone()); let segment = index.new_segment(); - let mut block_store = BlockStore::allocate(1_000); + let mut block_store = BlockStore::allocate(50_000); { let mut segment_writer = SegmentWriter::for_segment(&mut block_store, segment.clone(), &schema).unwrap(); { diff --git a/src/postings/postings_writer.rs b/src/postings/postings_writer.rs index 3e70cb1a7..2f1a176b7 100644 --- a/src/postings/postings_writer.rs +++ b/src/postings/postings_writer.rs @@ -23,9 +23,11 @@ pub struct SpecializedPostingsWriter { fn get_or_create_recorder<'a, Rec: Recorder>(term: Term, term_index: &'a mut HashMap, block_store: &mut BlockStore) -> &'a mut Rec { if term_index.contains_key(&term) { + println!("recorder here"); term_index.get_mut(&term).unwrap() } else { + println!("adding recorder"); let recorder = Rec::new(block_store); term_index .entry(term)