library: Only return top-level works

This commit is contained in:
Elias Projahn 2025-02-16 09:01:40 +01:00
parent 902ad97225
commit a8c66da52f

View file

@ -116,7 +116,11 @@ impl MusicusLibrary {
let works: Vec<Work> = works::table let works: Vec<Work> = works::table
.left_join(work_persons::table.inner_join(persons::table)) .left_join(work_persons::table.inner_join(persons::table))
.filter(works::name.like(&search).or(persons::name.like(&search))) .filter(
works::parent_work_id
.is_null()
.and(works::name.like(&search).or(persons::name.like(&search))),
)
.limit(9) .limit(9)
.select(works::all_columns) .select(works::all_columns)
.distinct() .distinct()