Backend: Add search filter for "original" file name #260
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
parent
3542bc5d61
commit
18f7a999fd
2 changed files with 5 additions and 0 deletions
|
@ -13,6 +13,7 @@ type PhotoSearch struct {
|
||||||
Path string `form:"path"`
|
Path string `form:"path"`
|
||||||
Folder string `form:"folder"` // Alias for Path
|
Folder string `form:"folder"` // Alias for Path
|
||||||
Name string `form:"name"`
|
Name string `form:"name"`
|
||||||
|
Original string `form:"original"`
|
||||||
Title string `form:"title"`
|
Title string `form:"title"`
|
||||||
Hash string `form:"hash"`
|
Hash string `form:"hash"`
|
||||||
Video bool `form:"video"`
|
Video bool `form:"video"`
|
||||||
|
|
|
@ -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, "*", "%"))
|
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 != "" {
|
if f.Title != "" {
|
||||||
s = s.Where("LOWER(photos.photo_title) LIKE ?", strings.ReplaceAll(strings.ToLower(f.Title), "*", "%"))
|
s = s.Where("LOWER(photos.photo_title) LIKE ?", strings.ReplaceAll(strings.ToLower(f.Title), "*", "%"))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue