API: GET albums should return photo count for additional album types #1981

Open
opened 2026-02-20 01:03:46 -05:00 by deekerman · 3 comments
Owner

Originally created by @ad-on-is on GitHub (Dec 12, 2023).

When fetching /albums?count=10&type=month the field PhotoCount is 0. Same goes for type=moments.

I'd expect it to have the number of Photos in that album.

Do I have to append something to the query?

Originally created by @ad-on-is on GitHub (Dec 12, 2023). When fetching `/albums?count=10&type=month` the field PhotoCount is 0. Same goes for type=moments. I'd expect it to have the number of Photos in that album. Do I have to append something to the query?
Author
Owner

@lastzero commented on GitHub (Dec 12, 2023):

This counter is currently only available for manually managed albums, as the number of matches for albums based on search filters is highly dynamic.

@lastzero commented on GitHub (Dec 12, 2023): This counter is currently only available for manually managed albums, as the number of matches for albums based on search filters is highly dynamic.
Author
Owner

@ad-on-is commented on GitHub (Dec 12, 2023):

That's a bummer. How do manual albums handle this? Is that field modified in the DB each time photos are added/deleted to an album? Would there be a performance issue by adding a subquery to fetch the count, to make it work across all albums?

@ad-on-is commented on GitHub (Dec 12, 2023): That's a bummer. How do manual albums handle this? Is that field modified in the DB each time photos are added/deleted to an album? Would there be a performance issue by adding a subquery to fetch the count, to make it work across all albums?
Author
Owner

@lastzero commented on GitHub (Dec 12, 2023):

See this SQL query for details:
github.com/photoprism/photoprism@467f7b1585/internal/search/albums.go (L33-L37)

You are welcome to send a PR with improvements if it does not significantly affect the performance for users with many albums!

@lastzero commented on GitHub (Dec 12, 2023): See this SQL query for details: https://github.com/photoprism/photoprism/blob/467f7b15859688b09ea0435fbd91c2c569511370/internal/search/albums.go#L33-L37 You are welcome to send a PR with improvements if it does not significantly affect the performance for users with many albums!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/photoprism#1981
No description provided.