diff --git a/src/core/search_stats.py b/src/core/search_stats.py
index ae86673..0f07dbb 100644
--- a/src/core/search_stats.py
+++ b/src/core/search_stats.py
@@ -335,6 +335,8 @@ class SearchStats:
def get_photos_without_faces(self) -> List[Tuple]:
"""Get photos that have no detected faces
+ Only includes processed photos (photos that have been processed for face detection).
+
Returns:
List of tuples: (photo_path, filename)
"""
@@ -343,11 +345,13 @@ class SearchStats:
with self.db.get_db_connection() as conn:
cursor = conn.cursor()
# Find photos that have no faces associated with them
+ # Only include processed photos
cursor.execute('''
SELECT p.path, p.filename
FROM photos p
LEFT JOIN faces f ON p.id = f.photo_id
WHERE f.photo_id IS NULL
+ AND p.processed = 1
ORDER BY p.filename
''')
for row in cursor.fetchall():
diff --git a/src/web/services/search_service.py b/src/web/services/search_service.py
index 7379072..d47b6f0 100644
--- a/src/web/services/search_service.py
+++ b/src/web/services/search_service.py
@@ -182,12 +182,14 @@ def get_photos_without_faces(
) -> Tuple[List[Photo], int]:
"""Get photos that have no detected faces.
+ Only includes processed photos (photos that have been processed for face detection).
Matches desktop behavior exactly.
"""
query = (
db.query(Photo)
.outerjoin(Face, Photo.id == Face.photo_id)
.filter(Face.photo_id.is_(None))
+ .filter(Photo.processed == True) # Only include processed photos
)
# Apply folder filter if provided