mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-05-30 15:10:40 +00:00
Unit tests passing.
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
{
|
||||
|
||||
@@ -23,9 +23,11 @@ pub struct SpecializedPostingsWriter<Rec: Recorder + 'static> {
|
||||
|
||||
fn get_or_create_recorder<'a, Rec: Recorder>(term: Term, term_index: &'a mut HashMap<Term, Rec>, 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)
|
||||
|
||||
Reference in New Issue
Block a user