Fixing tag selection

This commit is contained in:
micialware committed 2026-09-09 12:12:44 +03:00
1 parent a20c72eb9d
commit 7715aaff3b
5 files changed
+39 -626

No files matched your search

+5 -1
View File
@@ -283,7 +283,7 @@ impl<T: Clone + EntityData, D: DbLayer<T>> Deref for DataRepository<T, D> {
}
}
impl<T: EntityData + Clone, D: DbLayer<T>> DataRepositoryInner<T, D> {
impl<T: EntityData + Clone + std::marker::Send + std::marker::Sync, D: DbLayer<T>> DataRepositoryInner<T, D> {
pub fn query_par(
&self,
rule: Arc<dyn Fn(&T) -> bool + Send + Sync>,
@@ -344,6 +344,10 @@ impl<T: EntityData + Clone, D: DbLayer<T>> DataRepositoryInner<T, D> {
}
}
pub fn full_query(&self) -> Query<T, DataRepositoryInner<T, D>, D> {
self.query(Arc::new(|_| true))
}
pub fn len(&self) -> usize {
self.cache.len() + self.temporal.len()
}
+2 -2
View File
@@ -1,7 +1,7 @@
use std::collections::BTreeMap;
use crate::helpers::into_result;
use crate::notification::NotificationData;
use crate::notification::NotificationData::IncorrectAnkiFile;
use hashbrown::HashMap;
use log::info;
use rusqlite::Connection;
use serde_json::Value;
@@ -15,7 +15,7 @@ pub struct ImportGroup {
pub name: String,
pub fields: Vec<String>,
pub length: u64,
pub mapping: HashMap<String, String>,
pub mapping: BTreeMap<String, String>,
pub imported: bool,
}
+8 -4
View File
@@ -507,15 +507,19 @@ impl DictionaryState {
}
fn update_tags(&mut self) {
self.words_tags.clear();
let mut tags_list: HashSet<String> = HashSet::new();
let dict = &self.state.dictionary.write();
dict.iter().for_each(|element| {
split_with_coma(element.tags.as_str())
.iter()
let mut words_query = dict.full_query();
let handles = words_query.handles().collect::<Vec<_>>();
words_query.iter(dict).zip(handles).for_each(|(element, handle)| {
let tags = split_with_coma(element.tags.as_str());
tags.iter()
.for_each(|tag| {
tags_list.insert(tag.clone());
});
self.words_tags.push((handle, tags))
});
let current_tags = self