Struct tantivy::SegmentReader
source · [−]pub struct SegmentReader { /* private fields */ }
Expand description
Entry point to access all of the datastructures of the Segment
- term dictionary
- postings
- store
- fast field readers
- field norm reader
The segment reader has a very low memory footprint, as close to all of the memory data is mmapped.
Implementations
sourceimpl SegmentReader
impl SegmentReader
sourcepub fn max_doc(&self) -> DocId
pub fn max_doc(&self) -> DocId
Returns the highest document id ever attributed in this segment + 1.
sourcepub fn num_docs(&self) -> DocId
pub fn num_docs(&self) -> DocId
Returns the number of alive documents. Deleted documents are not counted.
sourcepub fn num_deleted_docs(&self) -> DocId
pub fn num_deleted_docs(&self) -> DocId
Return the number of documents that have been deleted in the segment.
sourcepub fn has_deletes(&self) -> bool
pub fn has_deletes(&self) -> bool
Returns true if some of the documents of the segment have been deleted.
sourcepub fn fast_fields(&self) -> &FastFieldReaders
pub fn fast_fields(&self) -> &FastFieldReaders
Accessor to a segment’s fast field reader given a field.
Returns the u64 fast value reader if the field is a u64 field indexed as “fast”.
Return a FastFieldNotAvailableError if the field is not declared as a fast field in the schema.
Panics
May panic if the index is corrupted.
sourcepub fn facet_reader(&self, field: Field) -> Result<FacetReader>
pub fn facet_reader(&self, field: Field) -> Result<FacetReader>
Accessor to the FacetReader
associated to a given Field
.
sourcepub fn get_fieldnorms_reader(&self, field: Field) -> Result<FieldNormReader>
pub fn get_fieldnorms_reader(&self, field: Field) -> Result<FieldNormReader>
Accessor to the segment’s Field norms
’s reader.
Field norms are the length (in tokens) of the fields. It is used in the computation of the TfIdf.
They are simply stored as a fast field, serialized in
the .fieldnorm
file of the segment.
sourcepub fn get_store_reader(&self) -> Result<StoreReader>
pub fn get_store_reader(&self) -> Result<StoreReader>
Accessor to the segment’s StoreReader
.
sourcepub fn open(segment: &Segment) -> Result<SegmentReader>
pub fn open(segment: &Segment) -> Result<SegmentReader>
Open a new segment for reading.
sourcepub fn open_with_custom_alive_set(
segment: &Segment,
custom_bitset: Option<AliveBitSet>
) -> Result<SegmentReader>
pub fn open_with_custom_alive_set(
segment: &Segment,
custom_bitset: Option<AliveBitSet>
) -> Result<SegmentReader>
Open a new segment for reading.
sourcepub fn inverted_index(&self, field: Field) -> Result<Arc<InvertedIndexReader>>
pub fn inverted_index(&self, field: Field) -> Result<Arc<InvertedIndexReader>>
Returns a field reader associated to the field given in argument. If the field was not present in the index during indexing time, the InvertedIndexReader is empty.
The field reader is in charge of iterating through the term dictionary associated to a specific field, and opening the posting list associated to any term.
If the field is marked as index, a warn is logged and an empty InvertedIndexReader
is returned.
Similarly if the field is marked as indexed but no term has been indexed for the given
index. an empty InvertedIndexReader
is returned (but no warning is logged).
sourcepub fn segment_id(&self) -> SegmentId
pub fn segment_id(&self) -> SegmentId
Returns the segment id
sourcepub fn delete_opstamp(&self) -> Option<Opstamp>
pub fn delete_opstamp(&self) -> Option<Opstamp>
Returns the delete opstamp
sourcepub fn alive_bitset(&self) -> Option<&AliveBitSet>
pub fn alive_bitset(&self) -> Option<&AliveBitSet>
Returns the bitset representing the documents that have been deleted.
sourcepub fn is_deleted(&self, doc: DocId) -> bool
pub fn is_deleted(&self, doc: DocId) -> bool
Returns true if the doc
is marked
as deleted.
sourcepub fn doc_ids_alive(&self) -> Box<dyn Iterator<Item = DocId>>
pub fn doc_ids_alive(&self) -> Box<dyn Iterator<Item = DocId>>
Returns an iterator that will iterate over the alive document ids
sourcepub fn space_usage(&self) -> Result<SegmentSpaceUsage>
pub fn space_usage(&self) -> Result<SegmentSpaceUsage>
Summarize total space usage of this segment.
Trait Implementations
sourceimpl Clone for SegmentReader
impl Clone for SegmentReader
sourcefn clone(&self) -> SegmentReader
fn clone(&self) -> SegmentReader
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl !RefUnwindSafe for SegmentReader
impl Send for SegmentReader
impl Sync for SegmentReader
impl Unpin for SegmentReader
impl !UnwindSafe for SegmentReader
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
sourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
sourceimpl<T> DowncastSync for T where
T: Any + Send + Sync,
impl<T> DowncastSync for T where
T: Any + Send + Sync,
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more