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

Global search slow when search within all courses user can access

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 3.9.6, 3.10.3, 3.11
    • None
    • Global search
    • None
    • MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_39_STABLE

    Description

      Query creation in Global search is slow when user have access to large number of courses. Users with Manager role usually have access to large number of courses.

      This issue is with creation of the query rather than execution. Therefore, it affects both search engines (simple & solr)

      It does not hugely impact site administrators because it function get_areas_user_accesses returns early for them or filter is applied.

      lib\accesslib.php uses static variables for caching. get_child_contexts() finds all child contexts for each course_context, add them into static cache.

      In large sites, for users who have access to 5000+ courses, it retrieves all their child contexts every time when using global search, making global search take 30+ seconds.

      I propose to add a new application cache area for child_contexts. It will be used to store child_contexts for a given context.

      We can populate static cache from application_cache instead of querying database for backwards compatibility.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              montypanday Monty Panday
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: