mirror of
https://github.com/ankitects/anki.git
synced 2025-12-10 21:36:55 -05:00
fix * handling in unqualifed text as well
https://forums.ankiweb.net/t/anki-2-1-desktop-searching-with-only-when-limited-to-a-field/3789/4
This commit is contained in:
parent
1b265f8024
commit
955c1bafb9
1 changed files with 4 additions and 3 deletions
|
|
@ -167,7 +167,7 @@ impl SqlWriter<'_> {
|
|||
|
||||
fn write_unqualified(&mut self, text: &str) {
|
||||
// implicitly wrap in %
|
||||
let text = format!("%{}%", text);
|
||||
let text = format!("%{}%", convert_glob_char(text));
|
||||
self.args.push(text);
|
||||
write!(
|
||||
self.sql,
|
||||
|
|
@ -595,15 +595,16 @@ mod test {
|
|||
|
||||
// unqualified search
|
||||
assert_eq!(
|
||||
s(ctx, "test"),
|
||||
s(ctx, "te*st"),
|
||||
(
|
||||
"((n.sfld like ?1 escape '\\' or n.flds like ?1 escape '\\'))".into(),
|
||||
vec!["%test%".into()]
|
||||
vec!["%te%st%".into()]
|
||||
)
|
||||
);
|
||||
assert_eq!(s(ctx, "te%st").1, vec!["%te%st%".to_string()]);
|
||||
// user should be able to escape sql wildcards
|
||||
assert_eq!(s(ctx, r#"te\%s\_t"#).1, vec!["%te\\%s\\_t%".to_string()]);
|
||||
assert_eq!(s(ctx, r#"te\*s\_t"#).1, vec!["%te\\*s\\_t%".to_string()]);
|
||||
|
||||
// qualified search
|
||||
assert_eq!(
|
||||
|
|
|
|||
Loading…
Reference in a new issue