Fix: author filtering
Build and Push Docker Image / build_docker_image (push) Successful in 8m3s

This commit is contained in:
2025-08-04 02:56:57 +08:00
parent 14ee46a24b
commit 604603785e
+4 -12
View File
@@ -44,18 +44,10 @@ impl FilterExt for Filter {
// 作者过滤 (NIP-01 支持前缀匹配)
if let Some(authors) = &self.authors {
if !authors.is_empty() {
sql.push(" AND (");
let mut separated = sql.separated(" OR ");
for author_prefix in authors {
if author_prefix.len() < 64 {
// 如果是公钥前缀,使用 LIKE
separated
.push("pubkey LIKE ")
.push_bind(format!("{}%", author_prefix));
} else {
// 否则进行精确匹配
separated.push("pubkey = ").push_bind(author_prefix);
}
sql.push(" AND pubkey IN (");
let mut separated = sql.separated(",");
for author in authors {
separated.push_bind(author);
}
separated.push_unseparated(")");
}