ErwinKomen / RU-passim

0 stars 0 forks source link

Manif search: related keywords #607

Closed MennaRempt closed 1 year ago

MennaRempt commented 2 years ago

When filtering the manifestations on keyword, manifestations that have that keyword as a related keyword (i.e. the manifestation is linked to an AF with that keyword) should also appear as results.

ErwinKomen commented 1 year ago

Implementation

  1. Where is this?
    1. This concerns the SermonListView, and then specifically the filter keyword
    2. This search currently looks for the kwlist, which gets filled as Keyword.get_scoped_queryset(username, team_group)
  2. The 'related keyword' addition should take place in SermonListView's method adapt_search():
    1. There already is an adaptation of the kwlist to restrict it to some particular keywords
    2. But this should now be re-worked into a Q-expression, that is a logical 'or' of the direct S-to-keyword links and the related keywords
    3. Keywords 'related' to an S via SSG:
      1. Link from S to SSG is via SermonDescrEqual, or more directly via S's field equalgolds
      2. Keywords attached to SSG are in the field keywords (m2m)
    4. So, how do I get all the Sermons that 'have' a particular keyword 'related' to them via the SSG?
      1. qs = SermonDescr.objects.filter(equalgolds__keywords__id__in=kwlist).distinct()
ErwinKomen commented 1 year ago

Okay, works