Skip to content

Commit

Permalink
Suggest child collections too
Browse files Browse the repository at this point in the history
  • Loading branch information
ato committed Jul 21, 2024
1 parent 9f39a35 commit 9f1573b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion common/src/pandas/collection/CollectionRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
public interface CollectionRepository extends CrudRepository<Collection, Long> {
List<Collection> findByParentIsNullAndSubjectsIsEmpty();

@Query("SELECT c FROM Collection c WHERE EXISTS (SELECT 1 FROM c.subjects s WHERE s IN :subjects)")
@Query("SELECT c FROM Collection c " +
"WHERE EXISTS (SELECT 1 FROM c.subjects s WHERE s IN :subjects) " +
"OR EXISTS (SELECT 1 FROM c.parent.subjects s WHERE s IN :subjects) " +
"OR EXISTS (SELECT 1 FROM c.parent.parent.subjects s WHERE s IN :subjects)")
List<Collection> findByAnyOfSubjects(@Param("subjects") List<Subject> subject);

@Query("select c from Collection c\n" +
Expand Down

0 comments on commit 9f1573b

Please sign in to comment.