pub struct WritableDatabase(/* private fields */);
Expand description
A Xapian database that can be read or written to
Implementations§
Source§impl WritableDatabase
impl WritableDatabase
Sourcepub fn open(
path: impl AsRef<Path>,
action: impl Into<Option<DbAction>>,
backend: impl Into<Option<DbBackend>>,
flags: impl Into<Option<DbFlags>>,
block_size: impl Into<Option<i32>>,
) -> Self
pub fn open( path: impl AsRef<Path>, action: impl Into<Option<DbAction>>, backend: impl Into<Option<DbBackend>>, flags: impl Into<Option<DbFlags>>, block_size: impl Into<Option<i32>>, ) -> Self
Open a database for updates
Automatically selects the appropriate backend to use
Sourcepub fn add_database(&mut self, db: impl AsRef<WritableDatabase>)
pub fn add_database(&mut self, db: impl AsRef<WritableDatabase>)
Add shards from another WritableDatabase
Sourcepub fn add_document(&mut self, doc: impl AsRef<Document>) -> DocId
pub fn add_document(&mut self, doc: impl AsRef<Document>) -> DocId
Add a new document to the database
Sourcepub fn add_spelling(
&self,
word: impl AsRef<str>,
increment: impl Into<Option<u32>>,
)
pub fn add_spelling( &self, word: impl AsRef<str>, increment: impl Into<Option<u32>>, )
Add a word to the spelling dictionary
Sourcepub fn add_synonym(&self, term: impl AsRef<str>, synonym: impl AsRef<str>)
pub fn add_synonym(&self, term: impl AsRef<str>, synonym: impl AsRef<str>)
Add a synonym for a term
Sourcepub fn begin_transaction(&mut self, flushed: impl Into<Option<bool>>)
pub fn begin_transaction(&mut self, flushed: impl Into<Option<bool>>)
Begin a transaction
Sourcepub fn cancel_transaction(&mut self)
pub fn cancel_transaction(&mut self)
Abort the transaction currently in progress
Sourcepub fn commit_transaction(&mut self)
pub fn commit_transaction(&mut self)
Complete the transaction currently in progress
Sourcepub fn delete_document(&mut self, id: impl Into<DocId>)
pub fn delete_document(&mut self, id: impl Into<DocId>)
Delete the document (if any) matching the specified DocId
from the database
Sourcepub fn delete_document_by_term(&mut self, term: impl AsRef<str>)
pub fn delete_document_by_term(&mut self, term: impl AsRef<str>)
Delete any documents indexed by the specified term from the database
Sourcepub fn metadata(&self, key: impl AsRef<str>) -> Bytes
pub fn metadata(&self, key: impl AsRef<str>) -> Bytes
Get the user-specified metadata associated with a given key
Sourcepub fn read_only(&self) -> Database
pub fn read_only(&self) -> Database
Retrieve a read-only Database
instance backed by this WritableDatabase
Sourcepub fn remove_spelling(
&self,
word: impl AsRef<str>,
decrement: impl Into<Option<u32>>,
)
pub fn remove_spelling( &self, word: impl AsRef<str>, decrement: impl Into<Option<u32>>, )
Remove a word from the spelling dictionary
Sourcepub fn remove_synonym(&self, term: impl AsRef<str>, synonym: impl AsRef<str>)
pub fn remove_synonym(&self, term: impl AsRef<str>, synonym: impl AsRef<str>)
Remove the given synonym for the specified term
Sourcepub fn replace_document(
&mut self,
id: impl Into<DocId>,
doc: impl AsRef<Document>,
)
pub fn replace_document( &mut self, id: impl Into<DocId>, doc: impl AsRef<Document>, )
Replace the document (if any) matching the specified DocId
from the database with the specified doc
Sourcepub fn replace_document_by_term(
&mut self,
term: impl AsRef<str>,
doc: impl AsRef<Document>,
) -> u32
pub fn replace_document_by_term( &mut self, term: impl AsRef<str>, doc: impl AsRef<Document>, ) -> u32
Replace any documents matching the given term
Sourcepub fn transaction(
&mut self,
flushed: impl Into<Option<bool>>,
f: impl FnMut(&mut WritableDatabase),
)
pub fn transaction( &mut self, flushed: impl Into<Option<bool>>, f: impl FnMut(&mut WritableDatabase), )
Wrap the function specified in f
in a transaction
Trait Implementations§
Source§impl Default for WritableDatabase
impl Default for WritableDatabase
Source§fn default() -> Self
fn default() -> Self
Open a new, in-memory WritableDatabase