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

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

pub fn get_field_entry(&self, field: Field) -> &FieldEntry[src]

Return the FieldEntry associated to a Field.

pub fn get_field_name(&self, field: Field) -> &str[src]

Return the field name for a given Field.

pub fn fields(&self) -> &[FieldEntry][src]

Return the list of all the Fields.

pub fn builder() -> SchemaBuilder[src]

Creates a new builder.

pub fn get_field(&self, field_name: &str) -> Option<Field>[src]

Returns the field option associated with a given name.

pub fn to_named_doc(&self, doc: &Document) -> NamedFieldDocument[src]

Create a named document off the doc.

pub fn to_json(&self, doc: &Document) -> String[src]

Encode the schema in JSON.

Encoding a document cannot fail.

pub fn parse_document(
    &self,
    doc_json: &str
) -> Result<Document, DocParsingError>
[src]

Build a document object from a json-object.

Trait Implementations

impl Clone for Schema[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl PartialEq<Schema> for Schema[src]

impl Eq for Schema[src]

impl Serialize for Schema[src]

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

Auto Trait Implementations

impl Sync for Schema

impl Send for Schema

impl Unpin for Schema

impl RefUnwindSafe for Schema

impl UnwindSafe for Schema

Blanket Implementations

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

impl<T, U> Into<U> for T where
    U: From<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> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> Erased for T[src]

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