Albums: Return all matching results when searching folders #3441
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
parent
8ca7a7fa1a
commit
1554e00039
1 changed files with 5 additions and 7 deletions
|
@ -147,14 +147,12 @@ func UserAlbums(f form.SearchAlbums, sess *entity.Session) (results AlbumResults
|
|||
|
||||
// Filter by title or path?
|
||||
if txt.NotEmpty(f.Query) {
|
||||
if f.Type != entity.AlbumFolder {
|
||||
likeString := "%" + f.Query + "%"
|
||||
s = s.Where("albums.album_title LIKE ? OR albums.album_location LIKE ?", likeString, likeString)
|
||||
q := "%" + strings.Trim(f.Query, " *%") + "%"
|
||||
|
||||
if f.Type == entity.AlbumFolder {
|
||||
s = s.Where("albums.album_title LIKE ? OR albums.album_location LIKE ? OR albums.album_path LIKE ?", q, q, q)
|
||||
} else {
|
||||
searchQuery := strings.Trim(strings.ReplaceAll(f.Query, "\\", "/"), "/")
|
||||
for _, where := range LikeAllNames(Cols{"albums.album_title", "albums.album_location", "albums.album_path"}, searchQuery) {
|
||||
s = s.Where(where)
|
||||
}
|
||||
s = s.Where("albums.album_title LIKE ? OR albums.album_location LIKE ?", q, q)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue