Fix writing dupe nodes
Rename comments and dupe functions on the backend accordingly to avoid further confusion.
This commit is contained in:
parent
7d81d39be7
commit
f4cfccfc0a
@ -293,8 +293,8 @@ fn search_node_for_text_with_argument<'a>(
|
||||
"is" => parse_state(val)?,
|
||||
"flag" => parse_flag(val)?,
|
||||
"rated" => parse_rated(val)?,
|
||||
"dupe" => parse_dupe(val)?,
|
||||
"resched" => parse_resched(val)?,
|
||||
"dupe" => parse_dupes(val)?,
|
||||
"prop" => parse_prop(val)?,
|
||||
"re" => SearchNode::Regex(unescape_quotes(val)),
|
||||
"nc" => SearchNode::NoCombining(unescape(val)?),
|
||||
@ -392,8 +392,8 @@ fn parse_resched(val: &str) -> ParseResult<SearchNode<'static>> {
|
||||
Ok(SearchNode::Rated { days, ease })
|
||||
}
|
||||
|
||||
/// eg dupes:1231,hello
|
||||
fn parse_dupes(val: &str) -> ParseResult<SearchNode> {
|
||||
/// eg dupe:1231,hello
|
||||
fn parse_dupe(val: &str) -> ParseResult<SearchNode> {
|
||||
let mut it = val.splitn(2, ',');
|
||||
let mid: NoteTypeID = it.next().unwrap().parse()?;
|
||||
let text = it.next().ok_or(ParseError {})?;
|
||||
|
@ -123,7 +123,7 @@ impl SqlWriter<'_> {
|
||||
self.write_single_field(&norm(field), &self.norm_note(text), *is_re)?
|
||||
}
|
||||
SearchNode::Duplicates { note_type_id, text } => {
|
||||
self.write_dupes(*note_type_id, &self.norm_note(text))?
|
||||
self.write_dupe(*note_type_id, &self.norm_note(text))?
|
||||
}
|
||||
SearchNode::Regex(re) => self.write_regex(&self.norm_note(re)),
|
||||
SearchNode::NoCombining(text) => self.write_no_combining(&self.norm_note(text)),
|
||||
@ -443,7 +443,7 @@ impl SqlWriter<'_> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn write_dupes(&mut self, ntid: NoteTypeID, text: &str) -> Result<()> {
|
||||
fn write_dupe(&mut self, ntid: NoteTypeID, text: &str) -> Result<()> {
|
||||
let text_nohtml = strip_html_preserving_media_filenames(text);
|
||||
let csum = field_checksum(text_nohtml.as_ref());
|
||||
|
||||
|
@ -119,7 +119,7 @@ fn write_search_node(node: &SearchNode) -> String {
|
||||
NoteType(s) => quote(&format!("note:{}", s)),
|
||||
Rated { days, ease } => write_rated(days, ease),
|
||||
Tag(s) => quote(&format!("tag:{}", s)),
|
||||
Duplicates { note_type_id, text } => quote(&format!("dupes:{},{}", note_type_id, text)),
|
||||
Duplicates { note_type_id, text } => quote(&format!("dupe:{},{}", note_type_id, text)),
|
||||
State(k) => write_state(k),
|
||||
Flag(u) => format!("\"flag:{}\"", u),
|
||||
NoteIDs(s) => format!("\"nid:{}\"", s),
|
||||
|
Loading…
Reference in New Issue
Block a user