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]
pub fn new() -> SchemaBuilder
[src]
Create a new SchemaBuilder
pub fn add_u64_field(
&mut self,
field_name_str: &str,
field_options: IntOptions
) -> Field
[src]
&mut self,
field_name_str: &str,
field_options: IntOptions
) -> Field
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
pub fn add_i64_field(
&mut self,
field_name_str: &str,
field_options: IntOptions
) -> Field
[src]
&mut self,
field_name_str: &str,
field_options: IntOptions
) -> Field
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
pub fn add_text_field(
&mut self,
field_name_str: &str,
field_options: TextOptions
) -> Field
[src]
&mut self,
field_name_str: &str,
field_options: TextOptions
) -> Field
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
pub fn add_facet_field(&mut self, field_name: &str) -> Field
[src]
Adds a facet field to the schema.
pub fn build(self) -> Schema
[src]
Finalize the creation of a Schema
This will consume your SchemaBuilder
Trait Implementations
impl Default for SchemaBuilder
[src]
fn default() -> SchemaBuilder
[src]
Returns the "default value" for a type. Read more
impl From<SchemaBuilder> for Schema
[src]
fn from(schema_builder: SchemaBuilder) -> Schema
[src]
Performs the conversion.