[−][src]Struct tantivy::schema::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) -> impl Iterator<Item = (Field, &FieldEntry)>
[src]
Return the list of all the Field
s.
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 convert_named_doc(
&self,
named_doc: NamedFieldDocument
) -> Result<Document, DocParsingError>
[src]
&self,
named_doc: NamedFieldDocument
) -> Result<Document, DocParsingError>
Create a named document off the doc.
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]
&self,
doc_json: &str
) -> Result<Document, DocParsingError>
Build a document object from a json-object.
Trait Implementations
impl Clone for Schema
[src]
impl<'de> Deserialize<'de> for Schema
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl Eq for Schema
[src]
impl PartialEq<Schema> for Schema
[src]
impl Serialize for Schema
[src]
impl StructuralEq for Schema
[src]
impl StructuralPartialEq for Schema
[src]
Auto Trait Implementations
impl RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl UnwindSafe for Schema
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> Downcast for T where
T: Any,
[src]
T: Any,
fn into_any(self: Box<T>) -> Box<dyn Any + 'static>
[src]
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
[src]
fn as_any(&self) -> &(dyn Any + 'static)
[src]
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
[src]
impl<T> DowncastSync for T where
T: Send + Sync + Any,
[src]
T: Send + Sync + Any,
impl<T> Erased for T
[src]
impl<T> From<T> for T
[src]
impl<T> Fruit for T where
T: Send + Downcast,
[src]
T: Send + Downcast,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,