Search: Improve "keywords" filter

This commit is contained in:
Michael Mayer 2021-09-20 22:39:29 +02:00
parent 77b7fb2582
commit b5964ffd38
2 changed files with 2 additions and 2 deletions

View file

@ -219,7 +219,7 @@ func Photos(f form.PhotoSearch) (results PhotoResults, count int, err error) {
// Search for one or more keywords?
if f.Keywords != "" {
for _, where := range LikeAllKeywords("k.keyword", f.Keywords) {
for _, where := range LikeAnyKeyword("k.keyword", f.Keywords) {
s = s.Where("photos.id IN (SELECT pk.photo_id FROM keywords k JOIN photos_keywords pk ON k.id = pk.keyword_id WHERE (?))", gorm.Expr(where))
}
}

View file

@ -109,7 +109,7 @@ func PhotosGeo(f form.PhotoSearchGeo) (results GeoResults, err error) {
// Search for one or more keywords?
if f.Keywords != "" {
for _, where := range LikeAllKeywords("k.keyword", f.Keywords) {
for _, where := range LikeAnyKeyword("k.keyword", f.Keywords) {
s = s.Where("photos.id IN (SELECT pk.photo_id FROM keywords k JOIN photos_keywords pk ON k.id = pk.keyword_id WHERE (?))", gorm.Expr(where))
}
}