pub struct DeduplicateEngine<'a> { /* private fields */ }Expand description
Deduplication workflow engine.
Implementations§
Source§impl<'a> DeduplicateEngine<'a>
impl<'a> DeduplicateEngine<'a>
Sourcepub async fn find_duplicates(
&self,
query: &DedupeQuery,
) -> Result<Vec<DuplicateGroup>>
pub async fn find_duplicates( &self, query: &DedupeQuery, ) -> Result<Vec<DuplicateGroup>>
Find groups of duplicate notes.
Notes are considered duplicates if they have the same value in the key field. Returns groups where each group has the note to keep and notes to delete.
§Arguments
query- Query parameters specifying search filter, key field, and keep strategy
§Example
let engine = Engine::new();
let query = DedupeQuery {
search: "deck:Vocabulary".to_string(),
key_field: "Word".to_string(),
keep: KeepStrategy::MostContent,
};
let groups = engine.deduplicate().find_duplicates(&query).await?;
for group in &groups {
println!("'{}': keep {}, delete {:?}",
group.key_value, group.keep_note_id, group.duplicate_note_ids);
}Sourcepub async fn preview(&self, query: &DedupeQuery) -> Result<DedupeReport>
pub async fn preview(&self, query: &DedupeQuery) -> Result<DedupeReport>
Preview deduplication without making changes.
Returns the same information as find_duplicates but formatted as a report.
Sourcepub async fn remove_duplicates(
&self,
query: &DedupeQuery,
) -> Result<DedupeReport>
pub async fn remove_duplicates( &self, query: &DedupeQuery, ) -> Result<DedupeReport>
Remove duplicate notes.
Keeps one note per duplicate group (based on keep strategy) and deletes the rest.
§Arguments
query- Query parameters specifying search filter, key field, and keep strategy
§Example
let engine = Engine::new();
let query = DedupeQuery {
search: "deck:Vocabulary tag:imported".to_string(),
key_field: "Word".to_string(),
keep: KeepStrategy::MostContent,
};
let report = engine.deduplicate().remove_duplicates(&query).await?;
println!("Deleted {} duplicates, kept {}", report.deleted, report.kept);Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for DeduplicateEngine<'a>
impl<'a> !RefUnwindSafe for DeduplicateEngine<'a>
impl<'a> Send for DeduplicateEngine<'a>
impl<'a> Sync for DeduplicateEngine<'a>
impl<'a> Unpin for DeduplicateEngine<'a>
impl<'a> !UnwindSafe for DeduplicateEngine<'a>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more