pub fn assert_existing_schema_matches(&self, existing: &Schema) -> Result<()> {
        let defined = self.as_tantivy_schema();
        let defined_fields = defined.fields().map(|(f, _)| defined.get_field_name(f));

        let existing_fields = existing.fields().map(|(f, _)| existing.get_field_name(f));

        let defined_fields_set: HashSet<&str> = HashSet::from_iter(defined_fields);
        let existing_fields_set: HashSet<&str> = HashSet::from_iter(existing_fields);

        let diff: Vec<&str> = defined_fields_set
            .difference(&existing_fields_set)
            .copied()
            .collect();

        if !diff.is_empty() {
            Err(anyhow!(
                "expected existing schema fields to be inline with defined schema from last save. \
                If you have *not* manually edited the index data then his is a bug and should be reported. \
                Got the following miss-aligned fields: {}",
                diff.join(", ")
            ))
        } else {
            Ok(())
        }
    }
/// Checks and asserts that the fields defined by Tantivy are also the same set of fields
/// defined in the schema.
///
/// These should never be off unless someone has manually modified the data.
Checks and asserts that the fields defined by Tantivy are also the same set of fields
defined in the schema.

These should never be off unless someone has manually modified the data.
Checks and asserts that the fields defined by Tantivy are also the same set of fields defined in the schema . These should never be off unless someone has manually modified the data .
pub fn assert_existing_schema_matches(&self, existing: &Schema) -> Result<()> {
        let defined = self.as_tantivy_schema();
        let defined_fields = defined.fields().map(|(f, _)| defined.get_field_name(f));
        let existing_fields = existing.fields().map(|(f, _)| existing.get_field_name(f));
        let defined_fields_set: HashSet<&str> = HashSet::from_iter(defined_fields);
        let existing_fields_set: HashSet<&str> = HashSet::from_iter(existing_fields);
        let diff: Vec<&str> = defined_fields_set
            .difference(&existing_fields_set)
            .copied()
            .collect();
        if !diff.is_empty() {
            Err(anyhow!(
                "expected existing schema fields to be inline with defined schema from last save. \
                If you have *not* manually edited the index data then his is a bug and should be reported. \
                Got the following miss-aligned fields: {}",
                diff.join(", ")
            ))
        } else {
            Ok(())
        }
    }
pub fn assert_existing_schema_matches ( & self , existing : & Schema ) -> Result < ( ) > { let defined = self . as_tantivy_schema ( ) ; let defined_fields = defined . fields ( ) . map ( | ( f , _ ) | defined . get_field_name ( f ) ) ; let existing_fields = existing . fields ( ) . map ( | ( f , _ ) | existing . get_field_name ( f ) ) ; let defined_fields_set : HashSet < & str > = HashSet :: from_iter ( defined_fields ) ; let existing_fields_set : HashSet < & str > = HashSet :: from_iter ( existing_fields ) ; let diff : Vec < & str > = defined_fields_set . difference ( & existing_fields_set ) . copied ( ) . collect ( ) ; if ! diff . is_empty ( ) { Err ( anyhow ! ( " \
 \
 " diff join ( " " ) ) ) } else { Ok ( ( ) ) } }
Checks and asserts that the fields defined by Tantivy are also the same set of fields
defined in the schema.
Checks and asserts that the fields defined by Tantivy are also the same set of fields defined in the schema .
&self
existing
&Schema
&self
existing
&Schema