diff --git a/internal/api/thumbnails.go b/internal/api/thumbnails.go index 38d2029f8..a298d87c0 100644 --- a/internal/api/thumbnails.go +++ b/internal/api/thumbnails.go @@ -54,6 +54,10 @@ func GetThumbnail(router *gin.RouterGroup, conf *photoprism.Config) { } else { log.Printf("could not find image for thumbnail: %s", err.Error()) c.Data(404, "image/svg+xml", photoIconSvg) + + // Set missing flag so that the file doesn't show up in search results anymore + file.FileMissing = true + conf.GetDb().Update(file) } }) } diff --git a/internal/photoprism/indexer.go b/internal/photoprism/indexer.go index 4b1bda7df..5679aeb45 100644 --- a/internal/photoprism/indexer.go +++ b/internal/photoprism/indexer.go @@ -188,6 +188,7 @@ func (i *Indexer) IndexMediaFile(mediaFile *MediaFile) string { file.PhotoID = photo.ID file.FilePrimary = isPrimary + file.FileMissing = false file.FileName = relativeFileName file.FileHash = fileHash file.FileType = mediaFile.GetType() diff --git a/internal/photoprism/search.go b/internal/photoprism/search.go index dddb7a78c..3a20183fc 100644 --- a/internal/photoprism/search.go +++ b/internal/photoprism/search.go @@ -107,7 +107,7 @@ func (s *Search) Photos(form PhotoSearchForm) ([]PhotoSearchResult, error) { Joins("LEFT JOIN locations ON locations.id = photos.location_id"). Joins("LEFT JOIN photo_tags ON photo_tags.photo_id = photos.id"). Joins("LEFT JOIN tags ON photo_tags.tag_id = tags.id"). - Where("photos.deleted_at IS NULL AND photos.file_missing = 0"). + Where("photos.deleted_at IS NULL AND files.file_missing = 0"). Group("photos.id, files.id") if form.Query != "" {