People: Improve search for names in photos #22

This commit is contained in:
Michael Mayer 2021-09-20 09:57:48 +02:00
parent 8577202b0a
commit 94b8a6ad65

View file

@ -237,7 +237,7 @@ func Photos(f form.PhotoSearch) (results PhotoResults, count int, err error) {
entity.Marker{}.TableName()), strings.Split(subj, txt.Or)) entity.Marker{}.TableName()), strings.Split(subj, txt.Or))
} }
} else if f.Subjects != "" { } else if f.Subjects != "" {
for _, where := range LikeAnyWord("s.subj_name", f.Subjects) { for _, where := range LikeAllNames(Cols{"subj_name", "subj_alias"}, f.Subjects) {
s = s.Where(fmt.Sprintf("photos.id IN (SELECT photo_id FROM files f JOIN %s m ON f.file_uid = m.file_uid AND m.marker_invalid = 0 JOIN %s s ON s.subj_uid = m.subj_uid WHERE (?))", s = s.Where(fmt.Sprintf("photos.id IN (SELECT photo_id FROM files f JOIN %s m ON f.file_uid = m.file_uid AND m.marker_invalid = 0 JOIN %s s ON s.subj_uid = m.subj_uid WHERE (?))",
entity.Marker{}.TableName(), entity.Subject{}.TableName()), gorm.Expr(where)) entity.Marker{}.TableName(), entity.Subject{}.TableName()), gorm.Expr(where))
} }