diff --git a/internal/form/photo_search.go b/internal/form/photo_search.go index 87ad93b42..df4956149 100644 --- a/internal/form/photo_search.go +++ b/internal/form/photo_search.go @@ -13,6 +13,7 @@ type PhotoSearch struct { Path string `form:"path"` Folder string `form:"folder"` // Alias for Path Name string `form:"name"` + Original string `form:"original"` Title string `form:"title"` Hash string `form:"hash"` Video bool `form:"video"` diff --git a/internal/query/photo_search.go b/internal/query/photo_search.go index d2738683d..bcb089734 100644 --- a/internal/query/photo_search.go +++ b/internal/query/photo_search.go @@ -219,6 +219,10 @@ func PhotoSearch(f form.PhotoSearch) (results PhotoResults, count int, err error s = s.Where("photos.photo_name LIKE ?", strings.ReplaceAll(f.Name, "*", "%")) } + if f.Original != "" { + s = s.Where("photos.original_name LIKE ?", strings.ReplaceAll(f.Original, "*", "%")) + } + if f.Title != "" { s = s.Where("LOWER(photos.photo_title) LIKE ?", strings.ReplaceAll(strings.ToLower(f.Title), "*", "%")) }