pub fn for_segment(
        memory_budget: usize,
        segment: Segment,
        schema: &Schema,
    ) -> crate::Result<SegmentWriter> {
        let tokenizer_manager = segment.index().tokenizers().clone();
        let table_num_bits = initial_table_size(memory_budget)?;
        let segment_serializer = SegmentSerializer::for_segment(segment)?;
        let multifield_postings = MultiFieldPostingsWriter::new(schema, table_num_bits);
        let tokenizers = schema
            .fields()
            .map(
                |(_, field_entry): (Field, &FieldEntry)| match field_entry.field_type() {
                    FieldType::Str(ref text_options) => text_options
                        .get_indexing_options()
                        .and_then(|text_index_option| {
                            let tokenizer_name = &text_index_option.tokenizer();
                            tokenizer_manager.get(tokenizer_name)
                        }),
                    _ => None,
                },
            )
            .collect();
        Ok(SegmentWriter {
            max_doc: 0,
            multifield_postings,
            fieldnorms_writer: FieldNormsWriter::for_schema(schema),
            segment_serializer,
            fast_field_writers: FastFieldsWriter::from_schema(schema),
            doc_opstamps: Vec::with_capacity(1_000),
            tokenizers,
        })
    }
/// Creates a new `SegmentWriter`
///
/// The arguments are defined as follows
///
/// - heap: most of the segment writer data (terms, and postings lists recorders)
/// is stored in a user-defined heap object. This makes it possible for the user to define
/// the flushing behavior as a buffer limit
/// - segment: The segment being written
/// - schema
Creates a new `SegmentWriter`
The arguments are defined as follows

most of the segment writer data (terms, and postings lists recorders)
is stored in a user-defined heap object. This makes it possible for the user to define
the flushing behavior as a buffer limit
segment: The segment being written
schema
Creates a new ` SegmentWriter ` The arguments are defined as follows most of the segment writer data ( terms and postings lists recorders ) is stored in a user - defined heap object . This makes it possible for the user to define the flushing behavior as a buffer limit segment : The segment being written schema
pub fn for_segment(
        memory_budget: usize,
        segment: Segment,
        schema: &Schema,
    ) -> crate::Result<SegmentWriter> {
        let tokenizer_manager = segment.index().tokenizers().clone();
        let table_num_bits = initial_table_size(memory_budget)?;
        let segment_serializer = SegmentSerializer::for_segment(segment)?;
        let multifield_postings = MultiFieldPostingsWriter::new(schema, table_num_bits);
        let tokenizers = schema
            .fields()
            .map(
                |(_, field_entry): (Field, &FieldEntry)| match field_entry.field_type() {
                    FieldType::Str(ref text_options) => text_options
                        .get_indexing_options()
                        .and_then(|text_index_option| {
                            let tokenizer_name = &text_index_option.tokenizer();
                            tokenizer_manager.get(tokenizer_name)
                        }),
                    _ => None,
                },
            )
            .collect();
        Ok(SegmentWriter {
            max_doc: 0,
            multifield_postings,
            fieldnorms_writer: FieldNormsWriter::for_schema(schema),
            segment_serializer,
            fast_field_writers: FastFieldsWriter::from_schema(schema),
            doc_opstamps: Vec::with_capacity(1_000),
            tokenizers,
        })
    }
pub fn for_segment ( memory_budget : usize , segment : Segment , schema : & Schema , ) -> crate :: Result < SegmentWriter > { let tokenizer_manager = segment . index ( ) . tokenizers ( ) . clone ( ) ; let table_num_bits = initial_table_size ( memory_budget ) ? ; let segment_serializer = SegmentSerializer :: for_segment ( segment ) ? ; let multifield_postings = MultiFieldPostingsWriter :: new ( schema , table_num_bits ) ; let tokenizers = schema . fields ( ) . map ( | ( _ , field_entry ) : ( Field , & FieldEntry ) | match field_entry . field_type ( ) { FieldType :: Str ( ref text_options ) => text_options . get_indexing_options ( ) . and_then ( | text_index_option | { let tokenizer_name = & text_index_option . tokenizer ( ) ; tokenizer_manager . get ( tokenizer_name ) } ) , _ => None , } , ) . collect ( ) ; Ok ( SegmentWriter { max_doc : 0 , multifield_postings , fieldnorms_writer : FieldNormsWriter :: for_schema ( schema ) , segment_serializer , fast_field_writers : FastFieldsWriter :: from_schema ( schema ) , doc_opstamps : Vec :: with_capacity ( 1_000 ) , tokenizers , } ) }
Creates a new `SegmentWriter`
The arguments are defined as follows
Creates a new ` SegmentWriter ` The arguments are defined as follows
memory_budget
usize
segment
Segment
schema
&Schema
memory_budget
usize
segment
Segment
schema
&Schema