pub fn as_tantivy_schema(&self) -> tantivy::schema::Schema {
        let mut schema = SchemaBuilder::new();
        schema.add_u64_field(PRIMARY_KEY, FAST | STORED | INDEXED);

        for (field, details) in self.fields.iter() {
            if field == PRIMARY_KEY {
                warn!(
                    "{} is a reserved field name due to being a primary key",
                    PRIMARY_KEY
                );
                continue;
            }

            match details {
                FieldDeclaration::U64 { opts } => {
                    schema.add_u64_field(field, *opts);
                },
                FieldDeclaration::I64 { opts } => {
                    schema.add_i64_field(field, *opts);
                },
                FieldDeclaration::F64 { opts } => {
                    schema.add_f64_field(field, *opts);
                },
                FieldDeclaration::Date { opts } => {
                    schema.add_date_field(field, *opts);
                },
                FieldDeclaration::Facet { opts } => {
                    schema.add_facet_field(field, *opts);
                },
                FieldDeclaration::Text { opts } => {
                    schema.add_text_field(field, opts.opts_as_text());
                },
                FieldDeclaration::String { opts } => {
                    schema.add_text_field(field, opts.opts_as_string());
                },
            }
        }

        schema.build()
    }
/// Generates a new schema from the given fields.
Generates a new schema from the given fields.
Generates a new schema from the given fields .
pub fn as_tantivy_schema(&self) -> tantivy::schema::Schema {
        let mut schema = SchemaBuilder::new();
        schema.add_u64_field(PRIMARY_KEY, FAST | STORED | INDEXED);
        for (field, details) in self.fields.iter() {
            if field == PRIMARY_KEY {
                warn!(
                    "{} is a reserved field name due to being a primary key",
                    PRIMARY_KEY
                );
                continue;
            }
            match details {
                FieldDeclaration::U64 { opts } => {
                    schema.add_u64_field(field, *opts);
                },
                FieldDeclaration::I64 { opts } => {
                    schema.add_i64_field(field, *opts);
                },
                FieldDeclaration::F64 { opts } => {
                    schema.add_f64_field(field, *opts);
                },
                FieldDeclaration::Date { opts } => {
                    schema.add_date_field(field, *opts);
                },
                FieldDeclaration::Facet { opts } => {
                    schema.add_facet_field(field, *opts);
                },
                FieldDeclaration::Text { opts } => {
                    schema.add_text_field(field, opts.opts_as_text());
                },
                FieldDeclaration::String { opts } => {
                    schema.add_text_field(field, opts.opts_as_string());
                },
            }
        }
        schema.build()
    }
pub fn as_tantivy_schema ( & self ) -> tantivy :: schema :: Schema { let mut schema = SchemaBuilder :: new ( ) ; schema . add_u64_field ( PRIMARY_KEY , FAST | STORED | INDEXED ) ; for ( field , details ) in self . fields . iter ( ) { if field == PRIMARY_KEY { warn ! ( " " PRIMARY_KEY ) ; continue ; } match details { FieldDeclaration :: U64 { opts } => { schema . add_u64_field ( field , * opts ) ; } , FieldDeclaration :: I64 { opts } => { schema . add_i64_field ( field , * opts ) ; } , FieldDeclaration :: F64 { opts } => { schema . add_f64_field ( field , * opts ) ; } , FieldDeclaration :: Date { opts } => { schema . add_date_field ( field , * opts ) ; } , FieldDeclaration :: Facet { opts } => { schema . add_facet_field ( field , * opts ) ; } , FieldDeclaration :: Text { opts } => { schema . add_text_field ( field , opts . opts_as_text ( ) ) ; } , FieldDeclaration :: String { opts } => { schema . add_text_field ( field , opts . opts_as_string ( ) ) ; } , } } schema . build ( ) }
Generates a new schema from the given fields.
Generates a new schema from the given fields .
&self
&self