Struct tantivy::InvertedIndexReader
source · [−]pub struct InvertedIndexReader { /* private fields */ }
Expand description
The inverted index reader is in charge of accessing the inverted index associated to a specific field.
Note
It is safe to delete the segment associated to
an InvertedIndexReader
. As long as it is open,
the FileSlice
it is relying on should
stay available.
InvertedIndexReader
are created by calling
the SegmentReader
’s [.inverted_index(...)
] method
Implementations
sourceimpl InvertedIndexReader
impl InvertedIndexReader
sourcepub fn empty(record_option: IndexRecordOption) -> InvertedIndexReader
pub fn empty(record_option: IndexRecordOption) -> InvertedIndexReader
Creates an empty InvertedIndexReader
object, which
contains no terms at all.
sourcepub fn get_term_info(&self, term: &Term) -> Result<Option<TermInfo>>
pub fn get_term_info(&self, term: &Term) -> Result<Option<TermInfo>>
Returns the term info associated with the term.
sourcepub fn terms(&self) -> &TermDictionary
pub fn terms(&self) -> &TermDictionary
Return the term dictionary datastructure.
sourcepub fn reset_block_postings_from_terminfo(
&self,
term_info: &TermInfo,
block_postings: &mut BlockSegmentPostings
) -> Result<()>
pub fn reset_block_postings_from_terminfo(
&self,
term_info: &TermInfo,
block_postings: &mut BlockSegmentPostings
) -> Result<()>
Resets the block segment to another position of the postings file.
This is useful for enumerating through a list of terms,
and consuming the associated posting lists while avoiding
reallocating a BlockSegmentPostings
.
Warning
This does not reset the positions list.
sourcepub fn read_block_postings(
&self,
term: &Term,
option: IndexRecordOption
) -> Result<Option<BlockSegmentPostings>>
pub fn read_block_postings(
&self,
term: &Term,
option: IndexRecordOption
) -> Result<Option<BlockSegmentPostings>>
Returns a block postings given a Term
.
This method is for an advanced usage only.
Most user should prefer using read_postings
instead.
sourcepub fn read_block_postings_from_terminfo(
&self,
term_info: &TermInfo,
requested_option: IndexRecordOption
) -> Result<BlockSegmentPostings>
pub fn read_block_postings_from_terminfo(
&self,
term_info: &TermInfo,
requested_option: IndexRecordOption
) -> Result<BlockSegmentPostings>
Returns a block postings given a term_info
.
This method is for an advanced usage only.
Most user should prefer using read_postings
instead.
sourcepub fn read_postings_from_terminfo(
&self,
term_info: &TermInfo,
option: IndexRecordOption
) -> Result<SegmentPostings>
pub fn read_postings_from_terminfo(
&self,
term_info: &TermInfo,
option: IndexRecordOption
) -> Result<SegmentPostings>
Returns a posting object given a term_info
.
This method is for an advanced usage only.
Most user should prefer using read_postings
instead.
sourcepub fn total_num_tokens(&self) -> u64
pub fn total_num_tokens(&self) -> u64
Returns the total number of tokens recorded for all documents (including deleted documents).
sourcepub fn read_postings(
&self,
term: &Term,
option: IndexRecordOption
) -> Result<Option<SegmentPostings>>
pub fn read_postings(
&self,
term: &Term,
option: IndexRecordOption
) -> Result<Option<SegmentPostings>>
Returns the segment postings associated with the term, and with the given option,
or None
if the term has never been encountered and indexed.
If the field was not indexed with the indexing options that cover
the requested options, the returned SegmentPostings
the method does not fail
and returns a SegmentPostings
with as much information as possible.
For instance, requesting IndexRecordOption::Freq
for a
TextIndexingOptions
that does not index position will return a SegmentPostings
with DocId
s and frequencies.
Auto Trait Implementations
impl !RefUnwindSafe for InvertedIndexReader
impl Send for InvertedIndexReader
impl Sync for InvertedIndexReader
impl Unpin for InvertedIndexReader
impl !UnwindSafe for InvertedIndexReader
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