diff --git a/meli.1 b/meli.1 index 702b8365..d400d501 100644 --- a/meli.1 +++ b/meli.1 @@ -143,7 +143,7 @@ uses the SEARCH command, uses libnotmuch and .Em Maildir/mbox performs a slow linear search. -It is advised to use a cache on +It is advised to use a search backend on .Em Maildir/mbox accounts. .Nm Ns @@ -159,7 +159,7 @@ and .Em Date . The message body (in plain text human readable form) and the flags can also be queried. To enable sqlite3 indexing for an account set -.Em cache_type +.Em search_backend to .Em sqlite3 in the configuration file and to create the sqlite3 index issue command @@ -190,7 +190,7 @@ Quotes should always be escaped. .Sy Important Notice about IMAP/JMAP .sp To prevent downloading all your messages from your IMAP/JMAP server, don't set -.Em cache_type +.Em search_backend to .Em sqlite3 Ns \&. diff --git a/meli.conf.5 b/meli.conf.5 index 8d8727d4..31a212d1 100644 --- a/meli.conf.5 +++ b/meli.conf.5 @@ -164,9 +164,9 @@ If true, do not monitor account for changes (you can use shortcut listing.refres .Pq Em optional command to execute when manually refreshing (shortcut listing.refresh) .Pq Em None -.It Ic cache_type Ar String +.It Ic search_backend Ar String .Pq Em optional -Choose which cache backend to use. +Choose which search backend to use. Available options are 'none' and 'sqlite3' .Pq Em "sqlite3" .It Ic vcard_folder Ar String diff --git a/src/components/mail/status.rs b/src/components/mail/status.rs index 3aa42ffa..0b314da5 100644 --- a/src/components/mail/status.rs +++ b/src/components/mail/status.rs @@ -460,17 +460,17 @@ impl Component for AccountStatus { ); write_string_to_grid( &if a.settings.account().format() == "imap" - && *a.settings.conf.cache_type() == CacheType::None + && *a.settings.conf.search_backend() == SearchBackend::None { "server-side search".to_string() } else if a.settings.account().format() == "notmuch" - && *a.settings.conf.cache_type() == CacheType::None + && *a.settings.conf.search_backend() == SearchBackend::None { "notmuch database".to_string() } else { #[cfg(feature = "sqlite3")] { - if *a.settings.conf.cache_type() == CacheType::Sqlite3 { + if *a.settings.conf.search_backend() == SearchBackend::Sqlite3 { if let Ok(path) = crate::sqlite3::db_path() { format!("sqlite3 database {}", path.display()) } else { diff --git a/src/conf.rs b/src/conf.rs index 88e925e5..8e149a99 100644 --- a/src/conf.rs +++ b/src/conf.rs @@ -164,7 +164,7 @@ pub struct FileAccount { #[serde(default)] mailboxes: HashMap, #[serde(default)] - cache_type: CacheType, + search_backend: SearchBackend, #[serde(default = "false_val")] pub manual_refresh: bool, #[serde(default = "none")] @@ -220,8 +220,8 @@ impl FileAccount { &self.root_mailbox } - pub fn cache_type(&self) -> &CacheType { - &self.cache_type + pub fn search_backend(&self) -> &SearchBackend { + &self.search_backend } } @@ -417,7 +417,7 @@ impl FileSettings { extra, manual_refresh, refresh_command: _, - cache_type: _, + search_backend: _, conf_override: _, } = acc.clone(); @@ -630,26 +630,26 @@ impl Serialize for IndexStyle { } #[derive(Debug, Clone, PartialEq)] -pub enum CacheType { +pub enum SearchBackend { None, #[cfg(feature = "sqlite3")] Sqlite3, } -impl Default for CacheType { +impl Default for SearchBackend { fn default() -> Self { #[cfg(feature = "sqlite3")] { - CacheType::Sqlite3 + SearchBackend::Sqlite3 } #[cfg(not(feature = "sqlite3"))] { - CacheType::None + SearchBackend::None } } } -impl<'de> Deserialize<'de> for CacheType { +impl<'de> Deserialize<'de> for SearchBackend { fn deserialize(deserializer: D) -> std::result::Result where D: Deserializer<'de>, @@ -657,22 +657,22 @@ impl<'de> Deserialize<'de> for CacheType { let s = ::deserialize(deserializer)?; match s.as_str() { #[cfg(feature = "sqlite3")] - "sqlite3" => Ok(CacheType::Sqlite3), - "nothing" | "none" | "" => Ok(CacheType::None), - _ => Err(de::Error::custom("invalid `index_cache` value")), + "sqlite3" => Ok(SearchBackend::Sqlite3), + "nothing" | "none" | "" => Ok(SearchBackend::None), + _ => Err(de::Error::custom("invalid `search_backend` value")), } } } -impl Serialize for CacheType { +impl Serialize for SearchBackend { fn serialize(&self, serializer: S) -> std::result::Result where S: Serializer, { match self { #[cfg(feature = "sqlite3")] - CacheType::Sqlite3 => serializer.serialize_str("sqlite3"), - CacheType::None => serializer.serialize_str("none"), + SearchBackend::Sqlite3 => serializer.serialize_str("sqlite3"), + SearchBackend::None => serializer.serialize_str("none"), } } } diff --git a/src/conf/accounts.rs b/src/conf/accounts.rs index 3d643579..af0c967a 100644 --- a/src/conf/accounts.rs +++ b/src/conf/accounts.rs @@ -353,7 +353,7 @@ impl Account { }; if settings.account().format() == "imap" { - settings.conf.cache_type = crate::conf::CacheType::None; + settings.conf.search_backend = crate::conf::SearchBackend::None; } let mut active_jobs = HashMap::default();