Search: Improve "keywords" filter
This commit is contained in:
parent
77b7fb2582
commit
b5964ffd38
2 changed files with 2 additions and 2 deletions
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue