Struct tantivy::schema::SchemaBuilder [] [src]

pub struct SchemaBuilder { /* fields omitted */ }

Tantivy has a very strict schema. You need to specify in advance whether a field is indexed or not, stored or not, and RAM-based or not.

This is done by creating a schema object, and setting up the fields one by one. It is for the moment impossible to remove fields.

Examples

use tantivy::schema::*;

let mut schema_builder = SchemaBuilder::default();
let id_field = schema_builder.add_text_field("id", STRING);
let title_field = schema_builder.add_text_field("title", TEXT);
let body_field = schema_builder.add_text_field("body", TEXT);
let schema = schema_builder.build();

Methods

impl SchemaBuilder
[src]

[src]

Create a new SchemaBuilder

[src]

Adds a new u64 field. Returns the associated field handle

Caution

Appending two fields with the same name will result in the shadowing of the first by the second one. The first field will get a field id but only the second one will be indexed

[src]

Adds a new i64 field. Returns the associated field handle

Caution

Appending two fields with the same name will result in the shadowing of the first by the second one. The first field will get a field id but only the second one will be indexed

[src]

Adds a new text field. Returns the associated field handle

Caution

Appending two fields with the same name will result in the shadowing of the first by the second one. The first field will get a field id but only the second one will be indexed

[src]

Adds a facet field to the schema.

[src]

Finalize the creation of a Schema This will consume your SchemaBuilder

Trait Implementations

impl Default for SchemaBuilder
[src]

[src]

Returns the "default value" for a type. Read more

impl From<SchemaBuilder> for Schema
[src]

[src]

Performs the conversion.