Skip to main content

TextSearch

Trait TextSearch 

Source
pub trait TextSearch:
    Send
    + Sync
    + 'static {
    // Required methods
    fn upsert_document<'life0, 'async_trait>(
        &'life0 self,
        document: TextDocument,
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn upsert_documents<'life0, 'async_trait>(
        &'life0 self,
        documents: Vec<TextDocument>,
    ) -> Pin<Box<dyn Future<Output = StorageResult<BatchWriteSummary>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete_document<'life0, 'life1, 'async_trait>(
        &'life0 self,
        namespace: &'life1 str,
        subject_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_document<'life0, 'life1, 'async_trait>(
        &'life0 self,
        namespace: &'life1 str,
        subject_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = StorageResult<Option<TextDocument>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn search<'life0, 'async_trait>(
        &'life0 self,
        request: TextSearchRequest,
    ) -> Pin<Box<dyn Future<Output = StorageResult<Vec<TextSearchHit>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn count<'life0, 'async_trait>(
        &'life0 self,
        filter: TextFilter,
    ) -> Pin<Box<dyn Future<Output = StorageResult<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stats<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = StorageResult<TextIndexStats>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn rebuild<'life0, 'async_trait>(
        &'life0 self,
        scope: IndexRebuildScope,
    ) -> Pin<Box<dyn Future<Output = StorageResult<TextIndexStats>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn search_with_options<'life0, 'async_trait>(
        &'life0 self,
        request: TextSearchRequest,
        options: TextSearchOptions,
    ) -> Pin<Box<dyn Future<Output = StorageResult<Vec<TextSearchHit>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn term_stats<'life0, 'async_trait>(
        &'life0 self,
        _request: TextTermStatsRequest,
    ) -> Pin<Box<dyn Future<Output = StorageResult<Vec<TextTermStats>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Full-text search capability over indexed documents.

Required Methods§

Source

fn upsert_document<'life0, 'async_trait>( &'life0 self, document: TextDocument, ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Index or update a single text document.

Source

fn upsert_documents<'life0, 'async_trait>( &'life0 self, documents: Vec<TextDocument>, ) -> Pin<Box<dyn Future<Output = StorageResult<BatchWriteSummary>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Index or update a batch of text documents.

Source

fn delete_document<'life0, 'life1, 'async_trait>( &'life0 self, namespace: &'life1 str, subject_id: Uuid, ) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove a document from the text index.

Source

fn get_document<'life0, 'life1, 'async_trait>( &'life0 self, namespace: &'life1 str, subject_id: Uuid, ) -> Pin<Box<dyn Future<Output = StorageResult<Option<TextDocument>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch an indexed document by namespace and subject ID.

Source

fn search<'life0, 'async_trait>( &'life0 self, request: TextSearchRequest, ) -> Pin<Box<dyn Future<Output = StorageResult<Vec<TextSearchHit>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Run a full-text search query and return ranked hits.

Source

fn count<'life0, 'async_trait>( &'life0 self, filter: TextFilter, ) -> Pin<Box<dyn Future<Output = StorageResult<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Count documents matching a filter.

Source

fn stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = StorageResult<TextIndexStats>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return index metadata and health statistics.

Source

fn rebuild<'life0, 'async_trait>( &'life0 self, scope: IndexRebuildScope, ) -> Pin<Box<dyn Future<Output = StorageResult<TextIndexStats>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Rebuild the text index, optionally scoped to a subset of entries.

Provided Methods§

Source

fn search_with_options<'life0, 'async_trait>( &'life0 self, request: TextSearchRequest, options: TextSearchOptions, ) -> Pin<Box<dyn Future<Output = StorageResult<Vec<TextSearchHit>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Search with explicit gather options (candidate-gather optimization).

Default delegates to search when options are default (Ranked mode). Backends that do not implement this return StorageError::Unsupported for non-default options, which the caller must handle by falling back or propagating.

Source

fn term_stats<'life0, 'async_trait>( &'life0 self, _request: TextTermStatsRequest, ) -> Pin<Box<dyn Future<Output = StorageResult<Vec<TextTermStats>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return per-term document frequency and IDF for a set of query terms.

Default returns StorageError::Unsupported. Only FTS5-backed stores provide a concrete implementation.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§