Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-58885

Global search: Add group support

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Use a Moodle site which already had global search configured with a working Solr install.
      2. After applying this patch, go to the search page.
        • EXPECTED: You might notice a slight pause while Solr updates the search schema.
      3. Try some searches through existing content.
        • EXPECTED: Search should still work as before.
      4. On a test course, set up at least 2 groups (referred to as 'Group 1' and 'Group 2' here).
      5. Create a new forum, set to separate groups mode.
      6. Make three posts in the forum: 'Zgrmplfz Forum All' set to all groups, 'Zgrmplfz Forum Group 1' in one group, and 'Zgrmplfz Forum Group 2' in the other group.
      7. Also create a new wiki, set to separate groups mode.
      8. In group 1 create a page with 'Zgrmplfz Wiki Group 1' text, and in group 2 with 'Zgrmplfz Wiki Group 2' text.
      9. Run search indexing (using the CLI or scheduled task)
      10. Search for 'Zgrmplfz' as admin.
        • EXPECTED: You should see all three posts and two wiki pages.
      11. Enrol a test account as student in the course and in Group 1, but not group 2.
      12. Log in using the test account and searsch for Zgrmplfz.
        • EXPECTED: You should see the 'All' and 'Group 1' posts and the 'Group 1' wiki page.
      13. As admin, give the test account Manager role on the course (has access all groups).
      14. As the test account, repeat the search.
        • EXPECTED: You should now see all three posts and both wiki pages.
      15. Remove the manager role (put the user back to student). Repeat the search as the test account just to confirm this worked.
        • EXPECTED: You should see the 'All' and 'Group 1' posts and the 'Group 1' wiki page.
      16. Change the forum and wiki to visible groups.
      17. Repeat the search as the test account.
        • EXPECTED: You should now see all three posts and both wiki pages.

      Note: So far as I'm aware these results should actually be the same as previous because they were filtered in PHP code, but this test checks that the new server-side filtering (at Solr level) is not filtering out results that should correctly display.

      Show
      Use a Moodle site which already had global search configured with a working Solr install. After applying this patch, go to the search page. EXPECTED: You might notice a slight pause while Solr updates the search schema. Try some searches through existing content. EXPECTED: Search should still work as before. On a test course, set up at least 2 groups (referred to as 'Group 1' and 'Group 2' here). Create a new forum, set to separate groups mode. Make three posts in the forum: 'Zgrmplfz Forum All' set to all groups, 'Zgrmplfz Forum Group 1' in one group, and 'Zgrmplfz Forum Group 2' in the other group. Also create a new wiki, set to separate groups mode. In group 1 create a page with 'Zgrmplfz Wiki Group 1' text, and in group 2 with 'Zgrmplfz Wiki Group 2' text. Run search indexing (using the CLI or scheduled task) Search for 'Zgrmplfz' as admin. EXPECTED: You should see all three posts and two wiki pages. Enrol a test account as student in the course and in Group 1, but not group 2. Log in using the test account and searsch for Zgrmplfz. EXPECTED: You should see the 'All' and 'Group 1' posts and the 'Group 1' wiki page. As admin, give the test account Manager role on the course (has access all groups). As the test account, repeat the search. EXPECTED: You should now see all three posts and both wiki pages. Remove the manager role (put the user back to student). Repeat the search as the test account just to confirm this worked. EXPECTED: You should see the 'All' and 'Group 1' posts and the 'Group 1' wiki page. Change the forum and wiki to visible groups. Repeat the search as the test account. EXPECTED: You should now see all three posts and both wiki pages. Note: So far as I'm aware these results should actually be the same as previous because they were filtered in PHP code, but this test checks that the new server-side filtering (at Solr level) is not filtering out results that should correctly display.
    • Affected Branches:
      MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_35_STABLE
    • Pull Master Branch:
      MDL-58885-master

      Description

      At the moment, the global search system does not have group support, i.e. there is no way to store a group id with indexed search data, and then do a search in a way that filters for that group.

      It is possible for a module to apply filters on the results, which can include group information. However there is not very efficient in cases where there are a large number of groups. For example, supposing there is a tutor group forum on an course that has 50 tutor groups. If you are a student belonging to one tutor group, then approximately 98% of the search results relating to this forum will be invalid and will get filtered - Solr would have to retrieve 500 results just to display 10 of them.

      It should be more efficient to include the group id into the search system and then, in the case of activities in 'separate groups' mode, automatically include only results from groups that the user belongs to, or from courses where they have 'access all groups' permission.

      This change will add group support to the search system back-end:

      • Search areas can add a group id into results.
      • Module search areas can indicate that a particular cm should restrict results to groups the user can access (because it's in separate groups mode).
      • The search engine will automatically exclude results for these modules if they are in a group the user doesn't belong to, and the group doesn't have access all groups.
      • There is back-end support for searching for results from a specific group id (or ids), but no user interface yet (this is difficult in the current interface; it will be added in a later change).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                quen Sam Marshall
                Reporter:
                quen Sam Marshall
                Peer reviewer:
                David Monllaó
                Integrator:
                Eloy Lafuente (stronk7)
                Tester:
                Zig Tan (Inactive)
                Participants:
                Component watchers:
                Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  17/May/18