Skip to main content

ObservedTextIndex

Struct ObservedTextIndex 

Source
pub struct ObservedTextIndex<I> { /* private fields */ }
Expand description

A borrowed live index or owned retained snapshot with its original participant. Construction and analyzer metadata access do not observe a query.

Implementations§

Source§

impl<I> ObservedTextIndex<I>

Source

pub fn new( index: I, read: Option<SerializableRelationRead>, columns: Arc<Vec<ColumnDef>>, ) -> Self

Trait Implementations§

Source§

impl<I: Deref<Target = dyn InvertedIndex> + Send + Sync> InvertedIndex for ObservedTextIndex<I>

Source§

fn analyzer(&self) -> &Analyzer

Source§

fn default_analyzer_binding(&self) -> StorageBackendResult<AnalyzerDefault>

Retain the exact default configuration, resource provider and already resolved revision without forcing deferred compilation. Controlled reconstruction requires this capability instead of copying and recompiling diagnostic configuration.
Source§

fn source_rebuild_required(&self) -> StorageBackendResult<bool>

Whether persisted positional data must be rebuilt from original sources before this index can be read or mutated. The owning engine performs this after restoring exact analyzer revisions, in the same initial-open transaction.
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

Compatibility configuration for search. Built-in providers return their independent retained search revision’s inputs; this default preserves the index fallback for custom legacy providers. Use search_analyzer_revision for execution with exact resource ownership.
Source§

fn index_analyzer_revision( &self, field: &str, ) -> StorageBackendResult<Arc<CompiledAnalyzer>>

Retain the exact executable index revision. Built-in providers resolve their default once and keep field revisions immutable.
Source§

fn search_analyzer_revision( &self, field: &str, ) -> StorageBackendResult<Arc<CompiledAnalyzer>>

Retain the exact executable search revision independently of subsequent index assignments.
Source§

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

Source§

fn try_add_documents( &mut self, _: 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, _: DocId) -> StorageBackendResult<()>

Source§

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

Source§

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

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

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

Read-only handle suitable for an ExecutionContext.
Source§

fn snapshot_with_control( &self, control: &StorageReadControl, ) -> StorageBackendResult<Arc<dyn InvertedIndex>>

Capture the selected view with its caller’s retention allowance. Providers that already retain their own read boundary preserve it; memory owners override this hook to charge their shared state before publication.
Source§

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

Source§

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

Unique-position compatibility projection for an exact term key. Legacy providers accept scalar keys and reject unpaired UTF-16 explicitly.
Source§

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

Source§

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

Read exact-key support without projecting UTF-16 term identity.
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_cursor_key( &self, field: &str, term: &TokenTermKey, ) -> StorageBackendResult<Box<dyn PostingCursor>>

Score cursor with exact term identity and occurrence frequency independent of unique positions.
Source§

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

Source§

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

Open exact-key cursors in input order, retaining repeated query terms. Scalar custom backends retain their optimized bulk implementation.
Source§

fn posting_read_cursor_key<'a>( &'a self, field: &'a str, term: &TokenTermKey, ) -> StorageBackendResult<Box<dyn PostingReadCursor + 'a>>

Traverse candidates while retaining this index read. Providers with borrowed posting maps can avoid copying the entire term support; owned persistent cursors keep their incremental reads.
Source§

fn posting_read_cursor_key_budgeted<'a>( &'a self, field: &'a str, term: &'a TokenTermKey, control: &StorageReadControl, ) -> StorageBackendResult<BudgetedPostingReadCursor<'a>>

Open a cursor that owns every query allocation under the supplied allowance. Providers must implement this capability without an unbounded materialization fallback.
Source§

fn visit_score_clusters( &self, field: &str, term: &TokenTermKey, after: Option<u64>, limit: usize, control: &StorageReadControl, visit: &mut ScoreClusterVisitor<'_>, ) -> StorageBackendResult<()>

Visit encoded score clusters in ascending order under the retained provider read. Temporary payloads must be reserved before fetching; callbacks must not reenter the provider.
Source§

fn get_occurrence_postings( &self, field: &str, term: &TokenTermKey, ) -> StorageBackendResult<Vec<OccurrencePosting>>

Complete graph edges in document order, preserving occurrence multiplicity and original source coordinates. Legacy positions cannot implement this contract without a source rebuild.
Source§

fn get_occurrences( &self, doc: DocId, field: &str, term: &TokenTermKey, ) -> StorageBackendResult<Vec<TokenOccurrence>>

Exact occurrences for one document and term; an absent document or term has no occurrences.
Source§

fn get_occurrences_budgeted( &self, doc: DocId, field: &str, term: &TokenTermKey, control: &StorageReadControl, ) -> StorageBackendResult<Budgeted<Vec<TokenOccurrence>>>

Decode one document’s exact occurrences with provider-owned input and output reservations and cancellation checks.
Source§

fn indexed_field_metadata( &self, doc: DocId, field: &str, ) -> StorageBackendResult<Option<IndexedFieldMetadata>>

Original stream-end state and revision metadata published with a document field, including fields that emitted no tokens.
Source§

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

Source§

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

Source§

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

Source§

fn get_term_freq_key( &self, doc: DocId, field: &str, term: &TokenTermKey, ) -> StorageBackendResult<u64>

Source§

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

Source§

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

Source§

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

Source§

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

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

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

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

fn field_stats_scalar_budgeted( &self, field: &str, control: &StorageReadControl, ) -> StorageBackendResult<IndexStats>

Read only field scoring scalars with producer-owned temporary reservations.
Source§

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

Field-specific statistics for BM25 scoring. 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 vocabulary_terms(&self, field: &str) -> StorageBackendResult<Vec<String>>

Sorted unique indexed terms for field. Read more
Source§

fn vocabulary_keys( &self, field: &str, ) -> StorageBackendResult<Vec<TokenTermKey>>

Sorted canonical term keys, including unpaired units. String-only vocabulary APIs must return an error if projection would lose identity.
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 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 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: DocId) -> StorageBackendResult<u64>

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

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

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

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

Visit every legacy unique-position projection for (field, term) in ascending doc-id order without handing out an owned list. Read more
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 uses posting support and the authoritative frequency accessor; persistent backends can stream compact frequency projections.
Source§

fn persisted_block_max_scores( &self, field: &str, term: &str, 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], 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 persisted_block_max_scores_keys_bulk( &self, field: &str, terms: &[TokenTermKey], fingerprint: &str, ) -> StorageBackendResult<Vec<Option<Vec<f64>>>>

Load exact-key scorer-versioned bounds. Custom scalar providers expose no raw-key materialization by default.
Source§

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

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

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

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

fn get_scoring_inputs_bulk( &self, docs: &[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_scoring_inputs_keys_bulk( &self, docs: &[DocId], field: &str, terms: &[TokenTermKey], ) -> StorageBackendResult<Vec<(u64, Vec<u64>)>>

Exact-key scoring inputs aligned with both the document and query-term arrays, including repetitions.
Source§

fn try_add_document( &mut self, doc_id: u64, fields: BTreeMap<String, String>, ) -> Result<(), StorageBackendError>

Source§

fn try_add_documents_observed( &mut self, _documents: Vec<(u64, BTreeMap<String, String>)>, _visit: &mut dyn FnMut(InvertedIndexChange<'_>) -> Result<(), StorageBackendError>, ) -> Result<(), StorageBackendError>

Capture logical changes from the same analysis and original reverse entries used by the atomic replacement. The visitor must not reenter this provider. A transaction owner discards captured changes on error and registers successful intents before completing its statement; private writes and intents must share savepoint undo.
Source§

fn try_remove_document_observed( &mut self, doc_id: u64, visit: &mut dyn FnMut(InvertedIndexChange<'_>) -> Result<(), StorageBackendError>, ) -> Result<(), StorageBackendError>

Deletion captures the original analyzed terms without reconstructing the document or rerunning its analyzer. An absent document produces no logical change.
Source§

fn try_remove_document( &mut self, doc_id: u64, ) -> Result<(), StorageBackendError>

Source§

fn try_clear(&mut self) -> Result<(), StorageBackendError>

Source§

fn try_rebuild_documents( &mut self, source: &mut dyn TextIndexSource, ) -> Result<(), StorageBackendError>

Replace every indexed document with the documents source reads. The default replaces them one at a time for custom backends; providers with atomic publication override it.
Source§

fn writable_snapshot( &self, ) -> Result<Box<dyn InvertedIndex>, StorageBackendError>

Independent writable copy used to restore an in-memory engine transaction without reconstructing analyzer state from documents.
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 set_field_analyzer_revision( &mut self, _field: &str, _revision: Arc<CompiledAnalyzer>, _phase: AnalyzerPhase, ) -> Result<(), String>

Install a validated revision without reopening its resources. This does not rebuild existing documents; graph providers reject a different index revision on a populated field and require rebuild_with_analyzer_revision instead.
Source§

fn set_field_analyzer_revisions( &mut self, _field: &str, _index: Arc<CompiledAnalyzer>, _search: Arc<CompiledAnalyzer>, ) -> Result<(), String>

Install a complete retained pair atomically. Failure changes neither side; this does not rebuild existing postings.
Source§

fn rebuild_with_analyzer_revision( &mut self, _field: &str, _revision: Arc<CompiledAnalyzer>, _phase: AnalyzerPhase, _source: &mut dyn TextIndexSource, ) -> Result<(), StorageBackendError>

Replace the complete indexed document set and selected analyzer sides together. Failure retains the previous postings and bindings; providers must implement their own atomic publication.
Source§

fn try_rebuild_documents_cancellable( &mut self, _source: &mut dyn TextIndexSource, cancellation: &CancellationToken, ) -> Result<(), StorageBackendError>

Rebuild under the caller’s cancellation token. Cancellation must retain the complete previous index; custom providers must implement atomic staging and cancellation.
Source§

fn rebuild_with_analyzer_revision_cancellable( &mut self, _field: &str, _revision: Arc<CompiledAnalyzer>, _phase: AnalyzerPhase, _source: &mut dyn TextIndexSource, cancellation: &CancellationToken, ) -> Result<(), StorageBackendError>

Replace postings and selected analyzer revisions together, retaining both on cancellation before publication.

Auto Trait Implementations§

§

impl<I> !RefUnwindSafe for ObservedTextIndex<I>

§

impl<I> !UnwindSafe for ObservedTextIndex<I>

§

impl<I> Freeze for ObservedTextIndex<I>
where I: Freeze,

§

impl<I> Send for ObservedTextIndex<I>
where I: Send,

§

impl<I> Sync for ObservedTextIndex<I>
where I: Sync,

§

impl<I> Unpin for ObservedTextIndex<I>
where I: Unpin,

§

impl<I> UnsafeUnpin for ObservedTextIndex<I>
where I: UnsafeUnpin,

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> ErasedDestructor for T
where T: 'static,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.