pub struct SegmentBuilder { /* private fields */ }Expand description
Builds a segment from analyzed documents.
Usage:
- Create with
new(segment_id, &schema) - Call
add_document()for each document - Call
build()to produce the segment bytes
Implementations§
Source§impl SegmentBuilder
impl SegmentBuilder
pub fn new(segment_id: SegmentId, schema: &Mapping) -> Self
Sourcepub fn add_document(
&mut self,
analyzed_fields: &[(FieldId, Vec<Token>)],
source: &[u8],
)
pub fn add_document( &mut self, analyzed_fields: &[(FieldId, Vec<Token>)], source: &[u8], )
Add a document with its analyzed fields and raw source JSON.
analyzed_fields contains (field_id, tokens) for each indexed field.
Keyword fields should have a single token with the exact value.
source is the original JSON bytes stored for _source retrieval.
Sourcepub fn mark_parent(&mut self)
pub fn mark_parent(&mut self)
Mark the most recently added doc as a parent (not nested).
Sourcepub fn mark_nested(&mut self)
pub fn mark_nested(&mut self)
Mark the current doc as a nested (hidden) doc.
Sourcepub fn add_geo_point(&mut self, field_id: FieldId, point: GeoPoint)
pub fn add_geo_point(&mut self, field_id: FieldId, point: GeoPoint)
Add a geo point for a geo_point field.
Sourcepub fn add_geo_shape(&mut self, field_id: FieldId, geom: &Geometry<f64>)
pub fn add_geo_shape(&mut self, field_id: FieldId, geom: &Geometry<f64>)
Add a geo shape for a geo_shape field.
Sourcepub fn add_column_value(&mut self, field_id: FieldId, value: ColumnValue)
pub fn add_column_value(&mut self, field_id: FieldId, value: ColumnValue)
Add a column value for a doc_values field.
Sourcepub fn segment_id(&self) -> SegmentId
pub fn segment_id(&self) -> SegmentId
The segment id assigned to this builder. Used by
[IndexWriter::add] to stamp the current doc’s
(segment_id, local_doc_id) pair into the global HNSW
resolver before add_document is called.
Auto Trait Implementations§
impl Freeze for SegmentBuilder
impl RefUnwindSafe for SegmentBuilder
impl Send for SegmentBuilder
impl Sync for SegmentBuilder
impl Unpin for SegmentBuilder
impl UnsafeUnpin for SegmentBuilder
impl UnwindSafe for SegmentBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more