mirror of
https://github.com/ankitects/anki.git
synced 2026-01-13 22:13:58 -05:00
add sc:... search option
This commit is contained in:
parent
2725dc4ce9
commit
0c9f5b0103
3 changed files with 9 additions and 0 deletions
|
|
@ -94,6 +94,7 @@ pub enum SearchNode {
|
||||||
WholeCollection,
|
WholeCollection,
|
||||||
Regex(String),
|
Regex(String),
|
||||||
NoCombining(String),
|
NoCombining(String),
|
||||||
|
StripClozes(String),
|
||||||
WordBoundary(String),
|
WordBoundary(String),
|
||||||
CustomData(String),
|
CustomData(String),
|
||||||
Preset(String),
|
Preset(String),
|
||||||
|
|
@ -358,6 +359,7 @@ fn search_node_for_text_with_argument<'a>(
|
||||||
"cid" => SearchNode::CardIds(check_id_list(val, key)?.into()),
|
"cid" => SearchNode::CardIds(check_id_list(val, key)?.into()),
|
||||||
"re" => SearchNode::Regex(unescape_quotes(val)),
|
"re" => SearchNode::Regex(unescape_quotes(val)),
|
||||||
"nc" => SearchNode::NoCombining(unescape(val)?),
|
"nc" => SearchNode::NoCombining(unescape(val)?),
|
||||||
|
"sc" => SearchNode::StripClozes(unescape(val)?),
|
||||||
"w" => SearchNode::WordBoundary(unescape(val)?),
|
"w" => SearchNode::WordBoundary(unescape(val)?),
|
||||||
"dupe" => parse_dupe(val)?,
|
"dupe" => parse_dupe(val)?,
|
||||||
"has-cd" => SearchNode::CustomData(unescape(val)?),
|
"has-cd" => SearchNode::CustomData(unescape(val)?),
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,11 @@ impl SqlWriter<'_> {
|
||||||
SearchNode::NoCombining(text) => {
|
SearchNode::NoCombining(text) => {
|
||||||
self.write_unqualified(&self.norm_note(text), true, false)?
|
self.write_unqualified(&self.norm_note(text), true, false)?
|
||||||
}
|
}
|
||||||
|
SearchNode::StripClozes(text) => self.write_unqualified(
|
||||||
|
&self.norm_note(text),
|
||||||
|
self.col.get_config_bool(BoolKey::IgnoreAccentsInSearch),
|
||||||
|
true,
|
||||||
|
)?,
|
||||||
SearchNode::WordBoundary(text) => self.write_word_boundary(&self.norm_note(text))?,
|
SearchNode::WordBoundary(text) => self.write_word_boundary(&self.norm_note(text))?,
|
||||||
|
|
||||||
// other
|
// other
|
||||||
|
|
@ -1020,6 +1025,7 @@ impl SearchNode {
|
||||||
SearchNode::Duplicates { .. } => RequiredTable::Notes,
|
SearchNode::Duplicates { .. } => RequiredTable::Notes,
|
||||||
SearchNode::Regex(_) => RequiredTable::Notes,
|
SearchNode::Regex(_) => RequiredTable::Notes,
|
||||||
SearchNode::NoCombining(_) => RequiredTable::Notes,
|
SearchNode::NoCombining(_) => RequiredTable::Notes,
|
||||||
|
SearchNode::StripClozes(_) => RequiredTable::Notes,
|
||||||
SearchNode::WordBoundary(_) => RequiredTable::Notes,
|
SearchNode::WordBoundary(_) => RequiredTable::Notes,
|
||||||
SearchNode::NotetypeId(_) => RequiredTable::Notes,
|
SearchNode::NotetypeId(_) => RequiredTable::Notes,
|
||||||
SearchNode::Notetype(_) => RequiredTable::Notes,
|
SearchNode::Notetype(_) => RequiredTable::Notes,
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ fn write_search_node(node: &SearchNode) -> String {
|
||||||
WholeCollection => "deck:*".to_string(),
|
WholeCollection => "deck:*".to_string(),
|
||||||
Regex(s) => maybe_quote(&format!("re:{s}")),
|
Regex(s) => maybe_quote(&format!("re:{s}")),
|
||||||
NoCombining(s) => maybe_quote(&format!("nc:{s}")),
|
NoCombining(s) => maybe_quote(&format!("nc:{s}")),
|
||||||
|
StripClozes(s) => maybe_quote(&format!("sc:{s}")),
|
||||||
WordBoundary(s) => maybe_quote(&format!("w:{s}")),
|
WordBoundary(s) => maybe_quote(&format!("w:{s}")),
|
||||||
CustomData(k) => maybe_quote(&format!("has-cd:{k}")),
|
CustomData(k) => maybe_quote(&format!("has-cd:{k}")),
|
||||||
Preset(s) => maybe_quote(&format!("preset:{s}")),
|
Preset(s) => maybe_quote(&format!("preset:{s}")),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue