// used both to merge field norms, `u64/i64` single fast fields.
used both to merge field norms, `u64/i64` single fast fields.
used both to merge field norms ` u64 / i64 ` single fast fields .
fn write_single_fast_field(
        &self,
        field: Field,
        fast_field_serializer: &mut FastFieldSerializer,
    ) -> crate::Result<()> {
        let mut u64_readers = vec![];
        let mut min_value = u64::max_value();
        let mut max_value = u64::min_value();
        for reader in &self.readers {
            let u64_reader: FastFieldReader<u64> = reader
                .fast_fields()
                .u64_lenient(field)
                .expect("Failed to find a reader for single fast field. This is a tantivy bug and it should never happen.");
            if let Some((seg_min_val, seg_max_val)) =
                compute_min_max_val(&u64_reader, reader.max_doc(), reader.delete_bitset())
            {
                // the segment has some non-deleted documents
                min_value = cmp::min(min_value, seg_min_val);
                max_value = cmp::max(max_value, seg_max_val);
                u64_readers.push((reader.max_doc(), u64_reader, reader.delete_bitset()));
            } else {
                // all documents have been deleted.
            }
        }
        if min_value > max_value {
            // There is not a single document remaining in the index.
            min_value = 0;
            max_value = 0;
        }
        let mut fast_single_field_serializer =
            fast_field_serializer.new_u64_fast_field(field, min_value, max_value)?;
        for (max_doc, u64_reader, delete_bitset_opt) in u64_readers {
            for doc_id in 0u32..max_doc {
                let is_deleted = delete_bitset_opt
                    .map(|delete_bitset| delete_bitset.is_deleted(doc_id))
                    .unwrap_or(false);
                if !is_deleted {
                    let val = u64_reader.get(doc_id);
                    fast_single_field_serializer.add_val(val)?;
                }
            }
        }
        fast_single_field_serializer.close_field()?;
        Ok(())
    }
fn write_single_fast_field ( & self , field : Field , fast_field_serializer : & mut FastFieldSerializer , ) -> crate :: Result < ( ) > { let mut u64_readers = vec ! [ ] ; let mut min_value = u64 :: max_value ( ) ; let mut max_value = u64 :: min_value ( ) ; for reader in & self . readers { let u64_reader : FastFieldReader < u64 > = reader . fast_fields ( ) . u64_lenient ( field ) . expect ( " " ) ; if let Some ( ( seg_min_val , seg_max_val ) ) = compute_min_max_val ( & u64_reader , reader . max_doc ( ) , reader . delete_bitset ( ) ) { // the segment has some non-deleted documents min_value = cmp :: min ( min_value , seg_min_val ) ; max_value = cmp :: max ( max_value , seg_max_val ) ; u64_readers . push ( ( reader . max_doc ( ) , u64_reader , reader . delete_bitset ( ) ) ) ; } else { // all documents have been deleted. } } if min_value > max_value { // There is not a single document remaining in the index. min_value = 0 ; max_value = 0 ; } let mut fast_single_field_serializer = fast_field_serializer . new_u64_fast_field ( field , min_value , max_value ) ? ; for ( max_doc , u64_reader , delete_bitset_opt ) in u64_readers { for doc_id in 0u32 .. max_doc { let is_deleted = delete_bitset_opt . map ( | delete_bitset | delete_bitset . is_deleted ( doc_id ) ) . unwrap_or ( false ) ; if ! is_deleted { let val = u64_reader . get ( doc_id ) ; fast_single_field_serializer . add_val ( val ) ? ; } } } fast_single_field_serializer . close_field ( ) ? ; Ok ( ( ) ) }
used both to merge field norms, `u64/i64` single fast fields.
used both to merge field norms ` u64 / i64 ` single fast fields .
&self
field
Field
fast_field_serializer
&mut FastFieldSerializer