Skip to main content

SQLiteInvertedIndex

Struct SQLiteInvertedIndex 

Source
pub struct SQLiteInvertedIndex { /* private fields */ }

Implementations§

Source§

impl SQLiteInvertedIndex

Source

pub fn skip_to( &self, field: &str, term: &str, target_doc_id: DocId, ) -> StorageBackendResult<(DocId, usize)>

Read the nearest materialized skip pointer without mutating storage. Call Self::flush_skip_pointers from an explicit maintenance/write boundary after postings change.

Source

pub fn build_block_max_scores<S: BlockMaxScorer + ?Sized>( &self, field: &str, term: &str, scorer: &S, ) -> StorageBackendResult<()>

Source

pub fn build_block_max_scores_versioned<S: BlockMaxScorer + ?Sized>( &self, field: &str, term: &str, scorer: &S, scorer_fingerprint: &str, ) -> StorageBackendResult<()>

Build one scorer-versioned block-max posting. The version is checked on load so changed BM25 parameters or field statistics can never feed an unsafe pruning bound.

Source

pub fn build_all_block_max_scores<S: BlockMaxScorer + ?Sized>( &self, field: &str, scorer: &S, ) -> StorageBackendResult<()>

Source

pub fn get_block_max_score( &self, field: &str, term: &str, block_idx: usize, ) -> StorageBackendResult<f64>

Source

pub fn get_all_block_max_scores( &self, field: &str, term: &str, ) -> StorageBackendResult<Vec<f64>>

Source

pub fn get_versioned_block_max_scores( &self, field: &str, term: &str, scorer_fingerprint: &str, ) -> StorageBackendResult<Option<Vec<f64>>>

Source

pub fn get_versioned_block_max_scores_bulk( &self, field: &str, terms: &[String], scorer_fingerprint: &str, ) -> StorageBackendResult<Vec<Option<Vec<f64>>>>

Source

pub fn load_block_max_into( &self, target: &mut BlockMaxIndex, ) -> StorageBackendResult<()>

Source§

impl SQLiteInvertedIndex

Source

pub const BLOCK_SIZE: usize = DEFAULT_BLOCK_SIZE

Source

pub fn new( conn: ManagedConnection, table: impl Into<String>, analyzer: Analyzer, ) -> Self

Source

pub fn tokenize( &self, text: &str, field: &str, ) -> StorageBackendResult<Vec<String>>

Tokenize text with the analyzer bound to field.

Source

pub fn skip_table_name(&self, field: &str) -> String

Source

pub fn blockmax_table_name(&self, field: &str) -> String

Source

pub fn flush_skip_pointers(&self) -> StorageBackendResult<()>

Trait Implementations§

Source§

impl Clone for SQLiteInvertedIndex

Source§

fn clone(&self) -> SQLiteInvertedIndex

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl InvertedIndex for SQLiteInvertedIndex

Source§

fn analyzer(&self) -> &Analyzer

Source§

fn add_document( &mut self, doc_id: DocId, fields: BTreeMap<FieldName, String>, ) -> StorageBackendResult<()>

Source§

fn try_add_documents( &mut self, documents: Vec<(DocId, BTreeMap<FieldName, String>)>, ) -> StorageBackendResult<()>

Add or replace several documents in input order. The default preserves the point-mutation contract for custom backends; transactional persistent backends can override this to make the call atomic and coalesce writes that share physical posting clusters.
Source§

fn remove_document(&mut self, doc_id: DocId) -> StorageBackendResult<()>

Source§

fn clear(&mut self) -> StorageBackendResult<()>

Source§

fn try_rebuild_documents( &mut self, documents: Vec<(DocId, BTreeMap<FieldName, String>)>, ) -> StorageBackendResult<()>

Source§

fn get_posting_list( &self, field: &str, term: &str, ) -> StorageBackendResult<PostingList>

Source§

fn get_posting_lists_bulk( &self, field: &str, terms: &[String], ) -> StorageBackendResult<Vec<PostingList>>

Source§

fn posting_cursor( &self, field: &str, term: &str, ) -> StorageBackendResult<Box<dyn PostingCursor>>

Open a doc-id ordered score cursor for one term. Read more
Source§

fn posting_cursors_bulk( &self, field: &str, terms: &[String], ) -> StorageBackendResult<Vec<Box<dyn PostingCursor>>>

Source§

fn rebuild_persisted_block_max( &mut self, field: &str, scorer: &dyn BlockMaxScorer, scorer_fingerprint: &str, ) -> StorageBackendResult<bool>

Persist scorer-specific block maxima for every term in field. Read more
Source§

fn persisted_block_max_scores( &self, field: &str, term: &str, scorer_fingerprint: &str, ) -> StorageBackendResult<Option<Vec<f64>>>

Load scorer-versioned block maxima for one posting list. None means the backend has no complete, valid materialization for this scorer.
Source§

fn persisted_block_max_scores_bulk( &self, field: &str, terms: &[String], scorer_fingerprint: &str, ) -> StorageBackendResult<Vec<Option<Vec<f64>>>>

Load scorer-versioned block maxima for several terms while preserving input order; persistent backends override this to avoid one storage round trip per term.
Source§

fn for_each_term_freq( &self, field: &str, term: &str, visit: &mut dyn FnMut(DocId, u64), ) -> StorageBackendResult<()>

Visit (doc_id, term_frequency) pairs without requiring callers to materialize or decode payload details they do not use. The default keeps every backend compatible through the posting-list contract; persistent backends can stream compact frequency projections.
Source§

fn doc_freq(&self, field: &str, term: &str) -> StorageBackendResult<u64>

Source§

fn get_doc_length( &self, doc_id: DocId, field: &str, ) -> StorageBackendResult<u64>

Source§

fn get_doc_lengths_bulk( &self, doc_ids: &[DocId], field: &str, ) -> StorageBackendResult<BTreeMap<DocId, u64>>

Bulk doc-length lookup. Default falls back to per-id calls.
Source§

fn get_scoring_inputs_bulk( &self, doc_ids: &[DocId], field: &str, terms: &[String], ) -> StorageBackendResult<Vec<(u64, Vec<u64>)>>

Fetch the document length and one term frequency per query term for every requested document. Results stay aligned with doc_ids. Persistent backends override this to collapse the scoring loop’s per-document point reads into a small number of set-oriented queries.
Source§

fn get_term_freq( &self, doc_id: DocId, field: &str, term: &str, ) -> StorageBackendResult<u64>

Source§

fn doc_count(&self) -> StorageBackendResult<u64>

Source§

fn total_field_length(&self, field: &str) -> StorageBackendResult<u64>

Source§

fn vocabulary_terms(&self, field: &str) -> StorageBackendResult<Vec<String>>

Sorted unique indexed terms for field. Read more
Source§

fn stats(&self) -> StorageBackendResult<IndexStats>

Fully-populated IndexStats snapshot for the cost model and scoring layer. Implementations may cache this between mutations.
Source§

fn posting_count(&self, field: Option<&str>) -> StorageBackendResult<u64>

Number of posting rows. With field = Some(..), limits the count to one indexed field.
Source§

fn doc_length_count(&self, field: Option<&str>) -> StorageBackendResult<u64>

Number of (doc_id, field) length rows. With field = Some(..), this is the number of documents indexed for that field.
Source§

fn term_count(&self, field: Option<&str>) -> StorageBackendResult<u64>

Number of distinct indexed terms. With field = Some(..), limits the count to one indexed field.
Source§

fn snapshot(&self) -> StorageBackendResult<Arc<dyn InvertedIndex>>

Read-only handle suitable for an ExecutionContext.
Source§

fn field_names(&self) -> StorageBackendResult<Vec<FieldName>>

Names of every field with at least one indexed document. Default implementation walks the IndexStats snapshot’s total-length map. Backends with a richer schema can override.
Source§

fn set_field_analyzer( &mut self, field: &str, analyzer: Analyzer, phase: AnalyzerPhase, ) -> Result<(), String>

Bind an analyzer to a single field for the given phase. Both writes to both the index-side and search-side maps; the default impl errors so backends that don’t support per-field analyzers fail loud rather than silently dropping the request.
Source§

fn remove_field_analyzers(&mut self, field: &str) -> Result<(), String>

Remove every per-field analyzer override for field. This is the inverse of set_field_analyzer(..., Both) and is required when the final logical FTS index for a field is dropped. The default errors so a backend cannot silently retain stale analysis behavior.
Source§

fn get_field_analyzer(&self, field: &str) -> Analyzer

Index-time analyzer for field; falls back to InvertedIndex::analyzer when no override is set.
Source§

fn get_search_analyzer(&self, field: &str) -> Analyzer

Search-time analyzer for field; falls back to the index-time analyzer, then to the default.
Source§

fn try_add_document( &mut self, doc_id: DocId, fields: BTreeMap<FieldName, String>, ) -> StorageBackendResult<()>

Source§

fn try_remove_document(&mut self, doc_id: DocId) -> StorageBackendResult<()>

Source§

fn try_clear(&mut self) -> StorageBackendResult<()>

Source§

fn for_each_posting( &self, field: &str, term: &str, visit: &mut dyn FnMut(&PostingEntry), ) -> StorageBackendResult<()>

Visit every posting entry for (field, term) in ascending doc-id order without handing out an owned list. Read more
Source§

fn field_doc_count(&self, field: &str) -> StorageBackendResult<u64>

Number of documents that have indexed content for field.
Source§

fn field_stats(&self, field: &str) -> StorageBackendResult<IndexStats>

Field-specific statistics for BM25 scoring. Read more
Source§

fn field_stats_scalar(&self, field: &str) -> StorageBackendResult<IndexStats>

InvertedIndex::field_stats without the vocabulary-wide document-frequency map. Read more
Source§

fn writable_snapshot(&self) -> StorageBackendResult<Box<dyn InvertedIndex>>

Independent writable copy used to restore an in-memory engine transaction without reconstructing analyzer state from documents.
Source§

fn get_posting_list_any_field( &self, term: &str, ) -> StorageBackendResult<PostingList>

Posting list for term across every indexed field, unioned together. Default implementation sums per-field posting lists via PostingList::merge_union.
Source§

fn doc_freq_any_field(&self, term: &str) -> StorageBackendResult<u64>

Document frequency of term across every indexed field.
Source§

fn get_total_doc_length(&self, doc_id: DocId) -> StorageBackendResult<u64>

Sum of all per-field token lengths for a single doc.
Source§

fn get_term_freqs_bulk( &self, doc_ids: &[DocId], field: &str, term: &str, ) -> StorageBackendResult<BTreeMap<DocId, u64>>

Bulk term-frequency lookup. Default falls back to per-id calls.
Source§

fn get_total_term_freq( &self, doc_id: DocId, term: &str, ) -> StorageBackendResult<u64>

Total term frequency for a doc summed across every indexed field.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.