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

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 = Schema::builder();
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<T: Into<IntOptions>>(
    &mut self,
    field_name_str: &str,
    field_options: T
) -> Field
[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

pub fn add_i64_field<T: Into<IntOptions>>(
    &mut self,
    field_name_str: &str,
    field_options: T
) -> Field
[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

pub fn add_f64_field<T: Into<IntOptions>>(
    &mut self,
    field_name_str: &str,
    field_options: T
) -> Field
[src]

Adds a new f64 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_date_field<T: Into<IntOptions>>(
    &mut self,
    field_name_str: &str,
    field_options: T
) -> Field
[src]

Adds a new date field. Returns the associated field handle Internally, Tantivy simply stores dates as i64 UTC timestamps, while the user supplies DateTime values for convenience.

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<T: Into<TextOptions>>(
    &mut self,
    field_name_str: &str,
    field_options: T
) -> Field
[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

pub fn add_facet_field(&mut self, field_name: &str) -> Field[src]

Adds a facet field to the schema.

pub fn add_bytes_field(&mut self, field_name: &str) -> Field[src]

Adds a fast bytes field to the schema.

Bytes field are not searchable and are only used as fast field, to associate any kind of payload to a document.

For instance, learning-to-rank often requires to access some document features at scoring time. These can be serializing and stored as a bytes field to get access rapidly when scoring each document.

pub fn build(self) -> Schema[src]

Finalize the creation of a Schema This will consume your SchemaBuilder

Trait Implementations

impl Default for SchemaBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Fruit for T where
    T: Send + Downcast
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T[src]

impl<T> Downcast for T where
    T: Any
[src]