Struct tantivy::SegmentReader [−][src]
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
Methods
impl SegmentReader
[src]
impl SegmentReader
pub fn max_doc(&self) -> DocId
[src]
pub fn max_doc(&self) -> DocId
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]
pub fn num_docs(&self) -> DocId
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]
pub fn schema(&self) -> &Schema
Returns the schema of the index this segment belongs to.
pub fn num_deleted_docs(&self) -> DocId
[src]
pub fn num_deleted_docs(&self) -> DocId
Return the number of documents that have been deleted in the segment.
pub fn has_deletes(&self) -> bool
[src]
pub fn has_deletes(&self) -> bool
Returns true iff some of the documents of the segment have been deleted.
pub fn fast_field_reader<Item: FastValue>(
&self,
field: Field
) -> Result<FastFieldReader<Item>>
[src]
pub fn fast_field_reader<Item: FastValue>(
&self,
field: Field
) -> Result<FastFieldReader<Item>>
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.
pub fn multi_fast_field_reader<Item: FastValue>(
&self,
field: Field
) -> Result<MultiValueIntFastFieldReader<Item>>
[src]
pub fn multi_fast_field_reader<Item: FastValue>(
&self,
field: Field
) -> Result<MultiValueIntFastFieldReader<Item>>
Accessor to the MultiValueIntFastFieldReader
associated to a given Field
.
May panick if the field is not a multivalued fastfield of the type Item
.
pub fn bytes_fast_field_reader(
&self,
field: Field
) -> Result<BytesFastFieldReader>
[src]
pub fn bytes_fast_field_reader(
&self,
field: Field
) -> Result<BytesFastFieldReader>
Accessor to the BytesFastFieldReader
associated to a given Field
.
pub fn facet_reader(&self, field: Field) -> Result<FacetReader>
[src]
pub fn facet_reader(&self, field: Field) -> Result<FacetReader>
Accessor to the FacetReader
associated to a given Field
.
pub fn get_fieldnorms_reader(&self, field: Field) -> FieldNormReader
[src]
pub fn get_fieldnorms_reader(&self, field: Field) -> 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] (https://fulmicoton.gitbooks.io/tantivy-doc/content/tfidf.html).
They are simply stored as a fast field, serialized in
the .fieldnorm
file of the segment.
pub fn get_store_reader(&self) -> &StoreReader
[src]
pub fn get_store_reader(&self) -> &StoreReader
Accessor to the segment's StoreReader
.
pub fn open(segment: &Segment) -> Result<SegmentReader>
[src]
pub fn open(segment: &Segment) -> Result<SegmentReader>
Open a new segment for reading.
pub fn inverted_index(&self, field: Field) -> Arc<InvertedIndexReader>
[src]
pub fn inverted_index(&self, field: Field) -> 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.
pub fn doc(&self, doc_id: DocId) -> Result<Document>
[src]
pub fn doc(&self, doc_id: DocId) -> Result<Document>
Returns the document (or to be accurate, its stored field) bearing the given doc id. This method is slow and should seldom be called from within a collector.
pub fn segment_id(&self) -> SegmentId
[src]
pub fn segment_id(&self) -> SegmentId
Returns the segment id
pub fn delete_bitset(&self) -> Option<&DeleteBitSet>
[src]
pub fn delete_bitset(&self) -> Option<&DeleteBitSet>
Returns the bitset representing the documents that have been deleted.
pub fn is_deleted(&self, doc: DocId) -> bool
[src]
pub fn is_deleted(&self, doc: DocId) -> bool
Returns true iff the doc
is marked
as deleted.
pub fn doc_ids_alive(&self) -> SegmentReaderAliveDocsIterator
[src]
pub fn doc_ids_alive(&self) -> SegmentReaderAliveDocsIterator
Returns an iterator that will iterate over the alive document ids
Trait Implementations
impl Clone for SegmentReader
[src]
impl Clone for SegmentReader
fn clone(&self) -> SegmentReader
[src]
fn clone(&self) -> SegmentReader
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for SegmentReader
[src]
impl Debug for SegmentReader
Auto Trait Implementations
impl Send for SegmentReader
impl Send for SegmentReader
impl !Sync for SegmentReader
impl !Sync for SegmentReader