Fix fields with \n being ignored when searching all fields w/o regex (#3943)

* add singleline flag to regex when searching all fields

* update test
This commit is contained in:
llama 2025-04-24 18:01:10 +08:00 committed by GitHub
parent e861364092
commit 1e6c8b2006
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -555,7 +555,7 @@ impl SqlWriter<'_> {
}
fn write_all_fields(&mut self, val: &str) {
self.args.push(format!("(?i)^{}$", to_re(val)));
self.args.push(format!("(?is)^{}$", to_re(val)));
write!(self.sql, "regexp_fields(?{}, n.flds)", self.args.len()).unwrap();
}
@ -1081,7 +1081,7 @@ mod test {
s(ctx, "*:te*st"),
(
"(regexp_fields(?1, n.flds))".into(),
vec!["(?i)^te.*st$".into()]
vec!["(?is)^te.*st$".into()]
)
);
// all field search with regex