Struct tantivy::schema::Schema [] [src]

pub struct Schema(_);

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 Schema
[src]

Return the FieldEntry associated to a Field.

Return the field name for a given Field.

Return the list of all the Fields.

Returns the field options associated with a given name.

Panics

Panics if the field name does not exist. It is meant as an helper for user who created and control the content of their schema.

If panicking is not an option for you, you may use get(&self, field_name: &str).

Create a named document off the doc.

Encode the schema in JSON.

Encoding a document cannot fail.

Build a document object from a json-object.

Trait Implementations

impl Clone for Schema
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Schema
[src]

Formats the value using the given formatter.

impl Serialize for Schema
[src]

Serialize this value into the given Serde serializer. Read more

impl<'de> Deserialize<'de> for Schema
[src]

Deserialize this value from the given Serde deserializer. Read more

impl From<SchemaBuilder> for Schema
[src]

Performs the conversion.