pub struct IndexingService { /* private fields */ }Expand description
The opt-in indexing service for synchronized folders.
Implementations§
Source§impl IndexingService
impl IndexingService
Sourcepub fn new(path: impl AsRef<Path>) -> Result<Self>
pub fn new(path: impl AsRef<Path>) -> Result<Self>
Start an indexing service backed by path.
§Errors
Returns an error if the database cannot be opened or initialized.
Sourcepub fn in_memory() -> Result<Self>
pub fn in_memory() -> Result<Self>
Start an in-memory indexing service.
§Errors
Returns an error if SQLite cannot initialize the schema.
Sourcepub fn with_database(database: IndexingDatabase) -> Result<Self>
pub fn with_database(database: IndexingDatabase) -> Result<Self>
Start a service from an already opened database.
§Errors
Returns an error if the denylist rules cannot be loaded from the database.
Sourcepub fn catalog_service(
&self,
docs: &DocsEngine,
blobs: &BlobStore,
author: AuthorId,
) -> CatalogService
pub fn catalog_service( &self, docs: &DocsEngine, blobs: &BlobStore, author: AuthorId, ) -> CatalogService
Create a catalog service backed by this indexing service.
Sourcepub fn denylist_service(&self) -> DenylistService
pub fn denylist_service(&self) -> DenylistService
Return the thread-safe local denylist used by indexing hooks.
pub const fn database(&self) -> &IndexingDatabase
Sourcepub fn search_local(
&self,
query: &str,
limit: usize,
) -> Result<Vec<IndexedEntry>>
pub fn search_local( &self, query: &str, limit: usize, ) -> Result<Vec<IndexedEntry>>
Search entries in folders enabled for local indexing.
§Errors
Returns an error if the query is invalid or SQLite cannot read results.
Sourcepub fn search_global(
&self,
query: &str,
limit: usize,
) -> Result<Vec<CatalogRecord>>
pub fn search_global( &self, query: &str, limit: usize, ) -> Result<Vec<CatalogRecord>>
Search records imported from subscribed catalogs.
§Errors
Returns an error if the query is invalid or SQLite cannot read results.
Sourcepub fn search(&self, query: &str, limit: usize) -> Result<Vec<CatalogRecord>>
pub fn search(&self, query: &str, limit: usize) -> Result<Vec<CatalogRecord>>
Search records imported from subscribed catalogs.
This is the service-level search used by indexing search. Records
blocked by the local denylist are excluded from discovery.
§Errors
Returns an error if the query is invalid or SQLite cannot read results.
Sourcepub fn subscribe(&self) -> Receiver<IndexingEvent>
pub fn subscribe(&self) -> Receiver<IndexingEvent>
Subscribe to indexing and core-engine events.
Sourcepub async fn enable_folder(
&self,
folder: &SyncwebFolder,
) -> Result<IndexingHandle>
pub async fn enable_folder( &self, folder: &SyncwebFolder, ) -> Result<IndexingHandle>
Opt a folder into indexing and begin consuming its document events.
Existing document entries are indexed before the method returns.
§Errors
Returns an error if the folder cannot be registered, read, or watched.
Sourcepub async fn disable_folder(&self, namespace_id: NamespaceId) -> Result<()>
pub async fn disable_folder(&self, namespace_id: NamespaceId) -> Result<()>
Stop indexing a folder and remove its local index entries.
§Errors
Returns an error if the folder index cannot be removed.
Sourcepub fn is_folder_enabled(&self, namespace_id: NamespaceId) -> Result<bool>
pub fn is_folder_enabled(&self, namespace_id: NamespaceId) -> Result<bool>
Return whether an indexing task is active for a folder.
§Errors
Returns an error if the task registry lock is poisoned.
Sourcepub fn index_entry(
&self,
namespace_id: NamespaceId,
entry: &Entry,
) -> Result<IndexedEntry>
pub fn index_entry( &self, namespace_id: NamespaceId, entry: &Entry, ) -> Result<IndexedEntry>
Index an entry supplied by another catalog or an application.
This method does not require a folder task, but the namespace must already be enabled.
§Errors
Returns an error if the namespace is not enabled or the entry cannot be stored.
Trait Implementations§
Source§impl Clone for IndexingService
impl Clone for IndexingService
Source§fn clone(&self) -> IndexingService
fn clone(&self) -> IndexingService
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for IndexingService
impl RefUnwindSafe for IndexingService
impl Send for IndexingService
impl Sync for IndexingService
impl Unpin for IndexingService
impl UnsafeUnpin for IndexingService
impl UnwindSafe for IndexingService
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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