[−][src]Struct tantivy::schema::SchemaBuilder
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();
Implementations
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]
&mut self,
field_name_str: &str,
field_options: T
) -> 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<T: Into<IntOptions>>(
&mut self,
field_name_str: &str,
field_options: T
) -> Field
[src]
&mut self,
field_name_str: &str,
field_options: T
) -> 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_f64_field<T: Into<IntOptions>>(
&mut self,
field_name_str: &str,
field_options: T
) -> Field
[src]
&mut self,
field_name_str: &str,
field_options: T
) -> Field
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]
&mut self,
field_name_str: &str,
field_options: T
) -> Field
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]
&mut self,
field_name_str: &str,
field_options: T
) -> 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 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 add_field(&mut self, field_entry: FieldEntry) -> Field
[src]
Adds a field entry to the schema in build.
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]
Auto Trait Implementations
impl RefUnwindSafe for SchemaBuilder
impl Send for SchemaBuilder
impl Sync for SchemaBuilder
impl Unpin for SchemaBuilder
impl UnwindSafe for SchemaBuilder
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> 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, 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>,