Skip to main content

SearchEngine

Struct SearchEngine 

Source
pub struct SearchEngine { /* private fields */ }
Expand description

Search over provider resources; local files are the default.

Indexing passes on one engine are serialized through resource commits and orphan pruning. Separate engines, including two processes sharing one SQLite cache, are not covered by this engine-local lease. Cached searches do not acquire it.

Implementations§

Source§

impl SearchEngine

Source

pub fn observe_indexing_lease( &self, observer: Arc<dyn Fn(LeaseEvent) + Send + Sync>, )

Install a test observer. It must not start indexing on this engine.

Source

pub fn lexical() -> Result<Self>

Search text and PDF text without model weights or stored vectors. Uses an isolated in-memory keyword index; never downloads a model.

Source

pub fn lexical_with_provider( provider: Arc<dyn ResourceProvider>, ) -> Result<Self>

Model-free keyword search using the same access policy as the caller.

Source

pub fn builder() -> SearchEngineBuilder

Source

pub fn extract(&self, hit: &SearchHit) -> Result<ExtractedContent>

Extract readable evidence from a hit, verifying its full-resource hash before any extractor receives bytes. Only explicit audio extraction may run STT.

Source

pub fn extract_audio_samples(&self, hit: &SearchHit) -> Result<Vec<f32>>

Verified selected audio samples, without STT. At most 30 seconds per slice.

Source

pub fn profile(&self) -> &CacheProfile

Source

pub fn profile_id(&self) -> &str

Source

pub fn embedder(&self) -> &dyn Embedder

Source

pub fn search<'e>(&'e self, query: impl Into<String>) -> SearchRequest<'e>

Start a search request. Add more phrasings of the same need with SearchRequest::query.

Source

pub fn index<'e>(&'e self) -> IndexRequest<'e>

Start an explicit indexing request (cache warming).

Source

pub fn with_cache<T>( &self, f: impl FnOnce(&mut dyn EmbeddingCache) -> Result<T>, ) -> Result<T>

Run a closure with exclusive access to the cache. The closure must not start indexing or call scrub_cache: both acquire the indexing lease before the cache mutex and would self-deadlock.

Source

pub fn scrub_cache(&self) -> Result<CacheCleanup>

Explicit privacy scrub. Index/search requests never invoke this themselves.

Do not call this from with_cache closures or indexing progress callbacks on this engine: reacquiring the cache mutex or indexing lease would deadlock.

Source

pub fn start_cache_scrubber(&self)

Start one idle-time worker for watcher/daemon/MCP use. It holds weak references and never runs in a request. On engine drop it stops after its current iteration and wakes any idle deadline wait immediately. Drop does not cancel or join an in-flight scrub.

Trait Implementations§

Source§

impl Drop for SearchEngine

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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> 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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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.