diff --git a/etiquette/photodb.py b/etiquette/photodb.py index 21763ac..dcd0ac3 100644 --- a/etiquette/photodb.py +++ b/etiquette/photodb.py @@ -628,6 +628,7 @@ class PDBPhotoMixin: #explain = self.sql_execute('EXPLAIN QUERY PLAN ' + query, bindings) #print('\n'.join(str(x) for x in explain.fetchall())) generator = self.sql_select(query, bindings) + seen_albums = set() photos_received = 0 for row in generator: photo = self.get_cached_instance('photo', row) @@ -654,6 +655,11 @@ class PDBPhotoMixin: if limit is not None and photos_received >= limit: break + for album in photo.get_containing_albums(): + if album not in seen_albums: + seen_albums.add(album) + yield album + photos_received += 1 yield photo diff --git a/frontends/etiquette_flask/backend/endpoints/photo_endpoints.py b/frontends/etiquette_flask/backend/endpoints/photo_endpoints.py index 7e6b2ab..aa6a4cd 100644 --- a/frontends/etiquette_flask/backend/endpoints/photo_endpoints.py +++ b/frontends/etiquette_flask/backend/endpoints/photo_endpoints.py @@ -408,7 +408,8 @@ def get_search_core(): # TAGS ON THIS PAGE total_tags = set() for photo in photos: - total_tags.update(photo.get_tags()) + if isinstance(photo, etiquette.objects.Photo): + total_tags.update(photo.get_tags()) total_tags = sorted(total_tags, key=lambda t: t.name) # PREV-NEXT PAGE URLS diff --git a/frontends/etiquette_flask/templates/search.html b/frontends/etiquette_flask/templates/search.html index 4fb1a14..ca131ad 100644 --- a/frontends/etiquette_flask/templates/search.html +++ b/frontends/etiquette_flask/templates/search.html @@ -2,6 +2,7 @@
{% import "photo_card.html" as photo_card %} + {% import "album_card.html" as album_card %} {% import "header.html" as header %} {% import "tag_object.html" as tag_object %} {% import "clipboard_tray.html" as clipboard_tray %} @@ -348,7 +349,11 @@ {{prev_next_buttons()}}