[][src]Struct tantivy::SegmentReader

pub struct SegmentReader { /* fields omitted */ }

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.

TODO fix not decoding docfreq


impl SegmentReader[src]

pub fn max_doc(&self) -> DocId[src]

Returns the highest document id ever attributed in this segment + 1. Today, tantivy does not handle deletes, so it happens to also be the number of documents in the index.

pub fn num_docs(&self) -> DocId[src]

Returns the number of documents. Deleted documents are not counted.

Today, tantivy does not handle deletes so max doc and num_docs are the same.

pub fn schema(&self) -> &Schema[src]

Returns the schema of the index this segment belongs to.

pub fn num_deleted_docs(&self) -> DocId[src]

Return the number of documents that have been deleted in the segment.

pub fn has_deletes(&self) -> bool[src]

Returns true iff some of the documents of the segment have been deleted.

pub fn fast_fields(&self) -> &FastFieldReaders[src]

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.


May panic if the index is corrupted.

pub fn facet_reader(&self, field: Field) -> Option<FacetReader>[src]

Accessor to the FacetReader associated to a given Field.

pub fn get_fieldnorms_reader(&self, field: Field) -> FieldNormReader[src]

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.

pub fn get_store_reader(&self) -> StoreReader[src]

Accessor to the segment's StoreReader.

pub fn open(segment: &Segment) -> Result<SegmentReader>[src]

Open a new segment for reading.

pub fn inverted_index(&self, field: Field) -> Arc<InvertedIndexReader>[src]

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.

pub fn segment_id(&self) -> SegmentId[src]

Returns the segment id

pub fn delete_bitset(&self) -> Option<&DeleteBitSet>[src]

Returns the bitset representing the documents that have been deleted.

pub fn is_deleted(&self, doc: DocId) -> bool[src]

Returns true iff the doc is marked as deleted.

pub fn doc_ids_alive(&self) -> SegmentReaderAliveDocsIterator[src]

Returns an iterator that will iterate over the alive document ids

pub fn space_usage(&self) -> SegmentSpaceUsage[src]

Summarize total space usage of this segment.

Trait Implementations

impl Clone for SegmentReader[src]

impl Debug for SegmentReader[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Fruit for T where
    T: Send + Downcast

impl<T, U> Into<U> for T where
    U: From<T>, 

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

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Erased for T[src]

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Send + Sync + Any