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

core_search: UI to search by group

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. You need a Moodle instance with working global search (Apache Solr).
      2. Create a test course with two groups, A Group and B Group.
      3. Create a test user (or use an existing test account), enrol them as a student, and add them to A group.
      4. Create three forums: Forum SG set to separate groups, Forum VG set to visible groups, and Forum Nope set to no groups
      5. Inside the first forum, change to group A and post a discussion with the title including the forum name, the group letter, plus the word baspliggle (e.g. Forum SG A baspliggle)
      6. Repeat this in group B and in the VG forum. Then repeat in the nope forum without the group. (You should now have made a total of five posts.)
      7. Update the search index (for example by running the Global search indexing scheduled task).
      8. As admin user, go to the SG forum and use the header search box to search for baspliggle. (NOTE: Be careful not to use the Search forums box, which isn't using global search.)
        • EXPECTED: You should see all 5 results.
      9. Expand the Filter fieldset.
        • EXPECTED: You should not see a Groups field yet.
      10. Change the Search within option to the course name.
        • EXPECTED: A Groups field should now appear.
      11. Use the autoselect to search for group A and repeat the search.
        • EXPECTED: You should see the two posts in group A (SG and VG)
      12. Change Search within to select the SG forum and repeat.
        • EXPECTED: You should see only the SG A post.
      13. Go to the Forum Nope forum and search from the top bar. Expand Filter, and change the Search within dropdown to select the course.
        • EXPECTED: As before you get a groups option.
      14. Change Search within to select the forum.
        • EXPECTED: The groups option disappears.
      15. Log in as the student account, go to Forum VG, and search for baspliggle.
        • EXPECTED: You should see 4 results (everything except the SG B post).
      16. Change Search within to select the course, then select B Group in the group selector, and repeat the search.
        • EXPECTED: You should see only 1 result (the VG B post).
      Show
      You need a Moodle instance with working global search (Apache Solr). Create a test course with two groups, A Group and B Group. Create a test user (or use an existing test account), enrol them as a student, and add them to A group. Create three forums: Forum SG set to separate groups, Forum VG set to visible groups, and Forum Nope set to no groups Inside the first forum, change to group A and post a discussion with the title including the forum name, the group letter, plus the word baspliggle (e.g. Forum SG A baspliggle ) Repeat this in group B and in the VG forum. Then repeat in the nope forum without the group. (You should now have made a total of five posts.) Update the search index (for example by running the Global search indexing scheduled task). As admin user, go to the SG forum and use the header search box to search for baspliggle . (NOTE: Be careful not to use the Search forums box, which isn't using global search.) EXPECTED: You should see all 5 results. Expand the Filter fieldset. EXPECTED: You should not see a Groups field yet. Change the Search within option to the course name. EXPECTED: A Groups field should now appear. Use the autoselect to search for group A and repeat the search. EXPECTED: You should see the two posts in group A (SG and VG) Change Search within to select the SG forum and repeat. EXPECTED: You should see only the SG A post. Go to the Forum Nope forum and search from the top bar. Expand Filter , and change the Search within dropdown to select the course. EXPECTED: As before you get a groups option. Change Search within to select the forum. EXPECTED: The groups option disappears. Log in as the student account, go to Forum VG , and search for baspliggle . EXPECTED: You should see 4 results (everything except the SG B post). Change Search within to select the course, then select B Group in the group selector, and repeat the search. EXPECTED: You should see only 1 result (the VG B post).
    • Affected Branches:
      MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_35_STABLE
    • Pull Master Branch:
      MDL-60953-master

      Description

      While the backend support for group searching (MDL-58885) is useful in that it automatically restricts the search results to those from groups the user can access, we can give more benefit for students if we actually expose a user interface to search by group, for example if you are looking at a tutor group forum, and you want to search only for posts within your group.

      Selecting groups only makes sense in the context of a single course or more specific search than that (activity, block), because groups are per-course.

      I propose this works as follows:

      • A new Groups autocomplete box in the search form filter section, similar to the existing 'Courses' and 'Areas' boxes.
      • The new option only displays if you have chosen to filter results to a specific course or activity within a course (using the new search within option, MDL-60880). It also doesn't display when you select a specific activity, if the specific activity does not have group mode enabled (separate/visible groups).
      • When the field is available, all groups in the course are available for selection. (I originally wanted to make this dependent on the option chosen in the dropdown but it is too complicated, because users can change the fields in either order.)
      • Default option will be empty, i.e. all groups; this will show results from any group, and also results that don't have an associated group.

      Note: One issue with this feature is that unlike MDL-58885, this will produce visibly wrong results if the relevant search areas have not been reindexed since the schema change to add groupid was applied. This means we could do with a better way to reindex a single search area (without deleting it) so that administrators can reindex after the upgrade (or maybe we could even do it automatically although I'm hesitant about that). I've submitted MDL-60981 to add that feature.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

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