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

Global Search: Split search results into tabs by category

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Requisites

      1. A site with courses, users, activities (bigger is better although you also can try this in a small one as far as there is some word like "testing" or so present often.
      2. Having the site indexed for global search.

      Description

      There are three new  search results display options added to the search admin interface (/admin/category.php?category=searchplugins):

      1. Display results in separate categories (yes/no)
      2. Default search category (Select list)
      3. Hide All results category (yes/no)
        These will be shown in the search results page when configured.

      Testing admin UI

      1. Verify that the 3 settings above are shown.
      2. Verify that the "Search areas" page (/admin/searchareas.php) now displays a list of categories for each area.

      Search testing

      Testing should cover all combinations of admin settings.

      1. If "Display results in separate categories" is set to No: global search results should remain the same as it is now.
      2. "Display results in separate categories" = yes, Default search category = All, "Hide All results category" = no: global search results should be spit by 5 tabs (All, Course content, Courses, Users, Other). User can switch between tabs and see only relevant to selected tab (category) list of items. Search area filter on each tab should display only areas associated to the selected category. Search area filter should reset if you switch between tabs. When a user search initially,  All tab should be displayed.
      3. "Display results in separate categories" = yes, Default search category = All, "Hide All results category" = yes: global search results should be spit by 4 tabs (Course content, Courses, Users, Other).  When a user search initially, Course content tab should be displayed.
      4. "Display results in separate categories" = yes, Default search category = Users, "Hide All results category" = yes: global search results should be spit by 4 tabs (Course content, Courses, Users, Other).  When a user search initially, Users tab should be displayed.
      5. If a user modify URL and set "cat" to not existing category (e.g. &cat=bla-bla-courses), result should be displayed from the Default search category.

      Assigning categories by plugin

      Also as the patch introduces a new call back "search_area_categories" probably we'd like to test that it works as well:

      1. Add a the following callback to mod/forum/lib.php:

        function forum_search_area_categories() { 
            $categories = [];
            $categories[] = new \core_search\area_category(
                'test-1',
                'Test1',
                0,
                \core_search\manager::get_search_areas_list(true)
            );
         
            $categories[] = new \core_search\area_category(
                'test-2',
                'Test2',
                10,
                [\core_search\manager::get_search_areas_list(true)['mod_forum-post']]
            );
         
            return $categories;
        }
        

      2. Search for some word that is present in your forum posts.
      3. Check if the new categories appear on the search screen
      4. Check if new categories appear in the Default search category select @ admin.
      5. Check if new categories are displayed in the search areas table (/admin/searchareas.php) and they are associated to correct areas:
        1. 'Test1' is shown in all areas.
        2. 'Test2' is only shown in forum posts area.
      Show
      Requisites 1. A site with courses, users, activities (bigger is better although you also can try this in a small one as far as there is some word like "testing" or so present often. 2. Having the site indexed for global search. Description There are three new  search results display options added to the search admin interface (/admin/category.php?category=searchplugins): Display results in separate categories (yes/no) Default search category (Select list) Hide All results category (yes/no) These will be shown in the search results page when configured. Testing admin UI Verify that the 3 settings above are shown. Verify that the "Search areas" page (/admin/searchareas.php) now displays a list of categories for each area. Search testing Testing should cover all combinations of admin settings. If "Display results in separate categories" is set to No : global search results should remain the same as it is now. "Display results in separate categories" = yes, Default search category = All, "Hide All results category" = no: global search results should be spit by 5 tabs (All, Course content, Courses, Users, Other). User can switch between tabs and see only relevant to selected tab (category) list of items. Search area filter on each tab should display only areas associated to the selected category. Search area filter should reset if you switch between tabs. When a user search initially,  All tab should be displayed. "Display results in separate categories" = yes, Default search category = All, "Hide All results category" = yes:  global search results should be spit by 4 tabs (Course content, Courses, Users, Other).  When a user search initially, Course content tab should be displayed. "Display results in separate categories" = yes, Default search category = Users, "Hide All results category" = yes:  global search results should be spit by 4 tabs (Course content, Courses, Users, Other).  When a user search initially, Users tab should be displayed. If a user modify URL and set "cat" to not existing category (e.g. &cat=bla-bla-courses), result should be displayed from the Default search category. Assigning categories by plugin Also as the patch introduces a new call back "search_area_categories" probably we'd like to test that it works as well: Add a the following callback to mod/forum/lib.php: function forum_search_area_categories() { $categories = []; $categories[] = new \core_search\area_category( 'test-1', 'Test1', 0, \core_search\manager::get_search_areas_list(true) );   $categories[] = new \core_search\area_category( 'test-2', 'Test2', 10, [\core_search\manager::get_search_areas_list(true)['mod_forum-post']] );   return $categories; } Search for some word that is present in your forum posts. Check if the new categories appear on the search screen Check if new categories appear in the Default search category select @ admin. Check if new categories are displayed in the search areas table (/admin/searchareas.php) and they are associated to correct areas: 'Test1' is shown in all areas. 'Test2' is only shown in forum posts area.
    • Affected Branches:
      MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-60913-search-tabs-master

      Description

      Currently all results delivered by Global Search are displayed on a single page. All result types are mixed in together. It is proposed that the results page is refactored to deliver results in 3 tabs. The default tab will show results from courses, the second will show users that match the search criteria and the third tab will show courses themselves.

      See attached wire-frames for examples.

      This proposed work will be sponsored by Alexander Bias and Ulm Uni. Catalyst to carry out the work.

      Broad tasks that need to implement:

      • Update core search renderer and template to support tabs
      • Update paged_search method in manager class to handle the three tabbed categories, including returning a complex object of the results
      • Update each Solr and Elastic execute_query (and associated methods) to return results split into 3 categories
      • Split search results into 3 ordered individual lists for each tab
      • Alter export_for_template method in document class to accommodate icons and different results types for each tab.

      It should also be noted that the extended aim here is to replace /course/search.php on sites that have Global search enabled and deliver course results via Global search instead. This is to deliver a unified search interface in moodle

        Attachments

        1. course.png
          course.png
          64 kB
        2. course-content.png
          course-content.png
          71 kB
        3. image-2017-11-30-17-08-45-423.png
          image-2017-11-30-17-08-45-423.png
          18 kB
        4. image-2017-11-30-17-09-13-100.png
          image-2017-11-30-17-09-13-100.png
          19 kB
        5. image-2017-11-30-17-09-44-150.png
          image-2017-11-30-17-09-44-150.png
          20 kB
        6. image-2017-11-30-19-19-58-993.png
          image-2017-11-30-19-19-58-993.png
          11 kB
        7. image-2017-11-30-19-21-15-645.png
          image-2017-11-30-19-21-15-645.png
          4 kB
        8. ugbus-search.png
          ugbus-search.png
          22 kB
        9. user.png
          user.png
          64 kB

          Issue Links

            Activity

              People

              • Votes:
                5 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  20/May/19