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
impl SearchEngine
Sourcepub fn observe_indexing_lease(
&self,
observer: Arc<dyn Fn(LeaseEvent) + Send + Sync>,
)
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.
Sourcepub fn lexical() -> Result<Self>
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.
Sourcepub fn lexical_with_provider(
provider: Arc<dyn ResourceProvider>,
) -> Result<Self>
pub fn lexical_with_provider( provider: Arc<dyn ResourceProvider>, ) -> Result<Self>
Model-free keyword search using the same access policy as the caller.
pub fn builder() -> SearchEngineBuilder
Sourcepub fn extract(&self, hit: &SearchHit) -> Result<ExtractedContent>
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.
Sourcepub fn extract_audio_samples(&self, hit: &SearchHit) -> Result<Vec<f32>>
pub fn extract_audio_samples(&self, hit: &SearchHit) -> Result<Vec<f32>>
Verified selected audio samples, without STT. At most 30 seconds per slice.
pub fn profile(&self) -> &CacheProfile
pub fn profile_id(&self) -> &str
pub fn embedder(&self) -> &dyn Embedder
Sourcepub fn search<'e>(&'e self, query: impl Into<String>) -> SearchRequest<'e>
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.
Sourcepub fn index<'e>(&'e self) -> IndexRequest<'e>
pub fn index<'e>(&'e self) -> IndexRequest<'e>
Start an explicit indexing request (cache warming).
Sourcepub fn with_cache<T>(
&self,
f: impl FnOnce(&mut dyn EmbeddingCache) -> Result<T>,
) -> Result<T>
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.
Sourcepub fn scrub_cache(&self) -> Result<CacheCleanup>
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.
Sourcepub fn start_cache_scrubber(&self)
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.