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

Speed up limittoenrolled option in course search

XMLWordPrintable

    • MOODLE_311_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE, MOODLE_402_STABLE
    • MOODLE_404_STABLE
    • MDL-74676-master
    • Hide

      Covered by unit test category_test::test_get_search_courses()

      Setup

      1. Login as admin.
      2. Create a site with a number of courses.
      3. Navigate to Site administration -> Plugins -> Search -> Manage global search
      4. Follow the steps to setup the "Simple search" search engine
      5. Ensure that the site is indexed.
      6. Ensure that the setting searchincludeallcourses is disabled.

      Testing

      1. Login as admin.
      2. Go to /search/ on your moodle instance.
      3. Enter a valid course name into course search.
      4. Verify that the search displays the correct search results.
      Show
      Covered by unit test category_test::test_get_search_courses() Setup Login as admin. Create a site with a number of courses. Navigate to Site administration -> Plugins -> Search -> Manage global search Follow the steps to setup the "Simple search" search engine Ensure that the site is indexed. Ensure that the setting searchincludeallcourses is disabled. Testing Login as admin. Go to /search/ on your moodle instance. Enter a valid course name into course search. Verify that the search displays the correct search results.

      If a form contains a course search element (e.g. course completion options in a course or meta enrollment) it searches all courses of the corresponding instance by default.

      In huge moodle instances (as we have here in Bavaria with > 400.000 courses) this literally kills course search (receiving a 500 error), so you have to change this function in some way to reduce the amount of courses to search.

      We chose to try setting the option "limittoenrolled", so the trainer can only choose courses which he is actually enrolled to (this restriction is fitting to our use case). But we noticed, that limittoenrolled does not fix the issue. The reason may be that the corresponding function first searches all courses of the instance (which delivers a huge dataset in our case again) and then checks every course for enrollment. 

      I'd propose to change the order here:

      • Get all courses the user is enrolled to
      • Then do the database query for further searching

      This should improve speed a lot for huge instances using this function - for most moodle instances nothing should change.

            stefan.hanauska Stefan Hanauska
            stefan.hanauska Stefan Hanauska
            David Woloszyn David Woloszyn
            Huong Nguyen Huong Nguyen
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            10 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 2 hours, 20 minutes
                1d 2h 20m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.