Repository navigation
feat(server): Add album filter to search - #18985
Conversation
- added inAlbums to search builder - only check isNotInAlbum if albumIds is blank/empty
| return qb.innerJoin( | ||
| (eb) => | ||
| eb | ||
| .selectFrom('albums_assets_assets') | ||
| .select('assetsId') | ||
| .where('albumsId', '=', anyUuid(albumIds!)) | ||
| .groupBy('assetsId') | ||
| .as('has_album'), | ||
| (join) => join.onRef('has_album.assetsId', '=', 'assets.id'), |
There was a problem hiding this comment.
where exists syntax should be faster than the comparatively expensive group by
There was a problem hiding this comment.
Right, I think it can actually be removed entirely; no need for it really without the HAVING...
I am not sure I like that. I get that it makes more sense for your specific use case, but for the tags multi-select it's currently an AND. I agree that we ideally want both, which is the overarching larger goal that has been discussed on Discord, but I'm not a fan of having different semantics for (visually) similar multi-selects. |
|
Fair enough, I'll update it to AND 👍 |
|
Updated, however brought back the GROUP BY HAVING, since it's the same mechanism used by all the other relationship filters (tags, people, etc). |
|
Happy to see what you can come up with! It can be a separate PR, yes |
|
Sounds good. No promises lol! Haven't had to work on building queries since college basically. |
|
Is this feature been implemented and available in Immich? |
The ui portions haven't been merged in yet. |
|
Thanks for the response. Are they planned to be merged or is it something that was dropped? |
|
No timelines unfortunately. It's quite out of date so will need time to rebase, however there were some blockers on the current implementation. |
Description
Adds an album filter to the search repository's searchAssetBuilder. The filter's albumIds behave like OR (photos within any of the selected albums). When albums are supplied, the isNotInAlbum filter is skipped.
Updated smart, metadata, and random search dtos, and applied open-api updates for dart & web dtos.
I have the web part built and will submit a separate PR once this is merged.
How Has This Been Tested?
Added the web front end to test search. Selecting albums from the albums search filter reduces search results to only those included in the albums
Checklist:
src/services/uses repositories implementations for database calls, filesystem operations, etc.src/repositories/is pretty basic/simple and does not have any immich specific logic (that belongs insrc/services/)