| 1441 | 
           ariadna | 
           1 | 
           === 4.5 Onwards ===
  | 
        
        
            | 
            | 
           2 | 
              | 
        
        
            | 
            | 
           3 | 
           This file has been replaced by UPGRADING.md. See MDL-81125 for further information.
  | 
        
        
            | 
            | 
           4 | 
              | 
        
        
            | 
            | 
           5 | 
           ===
  | 
        
        
           | 1 | 
           efrain | 
           6 | 
           This files describes API changes in /search/*,
  | 
        
        
            | 
            | 
           7 | 
           information provided here is intended especially for developers.
  | 
        
        
            | 
            | 
           8 | 
              | 
        
        
            | 
            | 
           9 | 
           === 4.2 ===
  | 
        
        
            | 
            | 
           10 | 
              | 
        
        
            | 
            | 
           11 | 
           * Support for optional final element returned by engine `add_documents()` implementations is now removed, all
  | 
        
        
            | 
            | 
           12 | 
             six expected returned array elements must be present
  | 
        
        
            | 
            | 
           13 | 
              | 
        
        
            | 
            | 
           14 | 
           === 3.10 ===
  | 
        
        
            | 
            | 
           15 | 
              | 
        
        
            | 
            | 
           16 | 
           * Search indexing now supports sending multiple documents to the server in a batch. This is implemented
  | 
        
        
            | 
            | 
           17 | 
             for the Solr search engine, where it significantly increases performance. For this to work, engines
  | 
        
        
            | 
            | 
           18 | 
             should implement add_document_batch() function and return true to supports_add_document_batch().
  | 
        
        
            | 
            | 
           19 | 
             There is also an additional parameter returned from add_documents() with the number of batches
  | 
        
        
            | 
            | 
           20 | 
             sent, which is used for the log display. Existing engines should continue to work unmodified.
  | 
        
        
            | 
            | 
           21 | 
           * Search engines can now implement the optional has_alternate_configuration() function to indicate
  | 
        
        
            | 
            | 
           22 | 
             if they provide two different connection configurations (for use when moving between two search
  | 
        
        
            | 
            | 
           23 | 
             engines of the same type). The constructor should also accept a boolean value (true = alternate);
  | 
        
        
            | 
            | 
           24 | 
             passing this to the base class constructor will automatically switch in the alternate
  | 
        
        
            | 
            | 
           25 | 
             configuration settings, provided they begin with 'alternate'.
  | 
        
        
            | 
            | 
           26 | 
              | 
        
        
            | 
            | 
           27 | 
           === 3.8 ===
  | 
        
        
            | 
            | 
           28 | 
              | 
        
        
            | 
            | 
           29 | 
           * Search indexing supports time limits to make the scheduled task run more neatly since 3.4. In order for
  | 
        
        
            | 
            | 
           30 | 
             this to work, search engine plugins will need to implement the 'stopat' parameter if they
  | 
        
        
            | 
            | 
           31 | 
             override the add_documents() function, and return an extra parameter from this function (see base
  | 
        
        
            | 
            | 
           32 | 
             class in engine.php). Unmodified plugins will not work anymore.
  | 
        
        
            | 
            | 
           33 | 
           * New search engine functions delete_index_for_context and delete_index_for_course are called by
  | 
        
        
            | 
            | 
           34 | 
             the search manager to inform the search engine it can remove some documents from its index.
  | 
        
        
            | 
            | 
           35 | 
             (Otherwise, documents from delete courses are never removed unless you reindex.) It is optional
  | 
        
        
            | 
            | 
           36 | 
             for search engines to support these; if they don't implement them then behaviour is unchanged.
  | 
        
        
            | 
            | 
           37 | 
              | 
        
        
            | 
            | 
           38 | 
           === 3.7 ===
  | 
        
        
            | 
            | 
           39 | 
              | 
        
        
            | 
            | 
           40 | 
           * Search areas now have categories and can optionally implement get_category_names method to
  | 
        
        
            | 
            | 
           41 | 
             display search results of the area in the required tab on the search results screen (if this
  | 
        
        
            | 
            | 
           42 | 
             feature is enabled).
  | 
        
        
            | 
            | 
           43 | 
           * Added a new call back search_area_categories. Plugins can implement this method in lib.php and
  | 
        
        
            | 
            | 
           44 | 
             return a list of custom search area categories (\core_search\area_category) and associated with
  | 
        
        
            | 
            | 
           45 | 
             them search areas. This will bring additional custom tabs to the search results screen.
  | 
        
        
            | 
            | 
           46 | 
           * Added \core_search\manager::clean_up_non_existing_area method to clean up removed or renamed
  | 
        
        
            | 
            | 
           47 | 
             search areas. To support that a new adhoc task core\task\clean_up_deleted_search_area_task
  | 
        
        
            | 
            | 
           48 | 
             added.
  | 
        
        
            | 
            | 
           49 | 
              | 
        
        
            | 
            | 
           50 | 
           === 3.5 ===
  | 
        
        
            | 
            | 
           51 | 
              | 
        
        
            | 
            | 
           52 | 
           * Search areas may now optionally implement the get_contexts_to_reindex function (for modules and
  | 
        
        
            | 
            | 
           53 | 
             blocks, see also get_contexts_to_reindex_extra_sql). This allows a search area to customise the
  | 
        
        
            | 
            | 
           54 | 
             order in which it is reindexed when doing a gradual reindex, so as to reindex the most important
  | 
        
        
            | 
            | 
           55 | 
             contexts first. If not implemented, the default behaviour for modules and blocks is to reindex
  | 
        
        
            | 
            | 
           56 | 
             the newest items first; for other types of search area it will just index the whole system
  | 
        
        
            | 
            | 
           57 | 
             context, oldest data first.
  | 
        
        
            | 
            | 
           58 | 
           * Search engines may now implement get_supported_orders function to provide multiple ordering
  | 
        
        
            | 
            | 
           59 | 
             options (other than 'relevance' which is default). If there is more than one order then a choice
  | 
        
        
            | 
            | 
           60 | 
             will be shown to users. (This is an optional feature, existing search engine plugins do not need
  | 
        
        
            | 
            | 
           61 | 
             to be modified in order to continue working.)
  | 
        
        
            | 
            | 
           62 | 
           * Module search areas that wish to support group filtering should set the new optional search
  | 
        
        
            | 
            | 
           63 | 
             document field groupid (note: to remain compatible with earlier versions, do this inside an if
  | 
        
        
            | 
            | 
           64 | 
             statement so that it only happens on 3.4+) and return true to the supports_group_restriction
  | 
        
        
            | 
            | 
           65 | 
             function. See documentation in \core_search\base_mod class and example in \mod_forum\search\post.
  | 
        
        
            | 
            | 
           66 | 
           * When a search engine supports group filtering, the \core_search\manager::search function now
  | 
        
        
            | 
            | 
           67 | 
             accepts the optional 'groupids' parameter in its $data input. This parameter is an array of one
  | 
        
        
            | 
            | 
           68 | 
             or more group IDs. If supplied, only results from those groups will be returned.
  | 
        
        
            | 
            | 
           69 | 
           * Search engine plugins will need to be be modified if they wish to support group filtering.
  | 
        
        
            | 
            | 
           70 | 
             (Search engines should continue to work unmodified, but will not then support group filtering.)
  | 
        
        
            | 
            | 
           71 | 
             The modification steps are:
  | 
        
        
            | 
            | 
           72 | 
             - Implement the new update_schema function to make the schema change (add groupid field).
  | 
        
        
            | 
            | 
           73 | 
             - Ensure that the groupid field is stored correctly when provided in a document while indexing.
  | 
        
        
            | 
            | 
           74 | 
             - Return true to new supports_group_filtering() function.
  | 
        
        
            | 
            | 
           75 | 
             - execute_query should support the new $data->groupids parameter (to allow users to restrict
  | 
        
        
            | 
            | 
           76 | 
               search results to specific groups) and the modified meaning of the second parameter,
  | 
        
        
            | 
            | 
           77 | 
               $accessinfo (to automatically restrict search results users cannot access due to groups).
  | 
        
        
            | 
            | 
           78 | 
               See implementation in Solr search engine.
  | 
        
        
            | 
            | 
           79 | 
           * Search engine plugins can optionally use a new $this->should_skip_schema_check() function to
  | 
        
        
            | 
            | 
           80 | 
             decide when to skip slow schema checking inside the is_server_ready function, improving user
  | 
        
        
            | 
            | 
           81 | 
             performance on the search page. The Solr plugin implements this.
  | 
        
        
            | 
            | 
           82 | 
           * API function \core_search\manager::instance() now includes a $fast parameter to skip schema
  | 
        
        
            | 
            | 
           83 | 
             checks (as above).
  | 
        
        
            | 
            | 
           84 | 
              | 
        
        
            | 
            | 
           85 | 
           * Search engines should now implement the 'userids' option to restrict search results to those from
  | 
        
        
            | 
            | 
           86 | 
             specific users, and return true to the new supports_users() function. The supplied Solr search
  | 
        
        
            | 
            | 
           87 | 
             engine includes this feature. If this is not implemented, the search engine will continue to work
  | 
        
        
            | 
            | 
           88 | 
             but the 'Users' search option will not appear.
  | 
        
        
            | 
            | 
           89 | 
              | 
        
        
            | 
            | 
           90 | 
           === 3.4 ===
  | 
        
        
            | 
            | 
           91 | 
              | 
        
        
            | 
            | 
           92 | 
           * Search indexing now supports time limits to make the scheduled task run more neatly. In order for
  | 
        
        
            | 
            | 
           93 | 
             this to work, search engine plugins will need to implement the 'stopat' parameter if they
  | 
        
        
            | 
            | 
           94 | 
             override the add_documents() function, and return an extra parameter from this function (see base
  | 
        
        
            | 
            | 
           95 | 
             class in engine.php). Unmodified plugins will still work, but without supporting time limits.
  | 
        
        
            | 
            | 
           96 | 
           * Search areas should now implement the get_document_recordset function instead of the old
  | 
        
        
            | 
            | 
           97 | 
             get_recordset_by_timestamp API (implement both if the area should work in older Moodle versions
  | 
        
        
            | 
            | 
           98 | 
             as well). The new function is the same as the old one, but has an additional context parameter.
  | 
        
        
            | 
            | 
           99 | 
             There is a helper function get_context_restriction_sql to make this easy to implement; see code
  | 
        
        
            | 
            | 
           100 | 
             in base_activity.php for an example of how to implement this in your search area. (The
  | 
        
        
            | 
            | 
           101 | 
             change was required to make search work after restoring sites. It also allows more flexible
  | 
        
        
            | 
            | 
           102 | 
             reindexing in other cases.)
  | 
        
        
            | 
            | 
           103 | 
              | 
        
        
            | 
            | 
           104 | 
           === 3.2 ===
  | 
        
        
            | 
            | 
           105 | 
              | 
        
        
            | 
            | 
           106 | 
           * Base search area classes have been renamed, please update your search areas to use the classes below:
  | 
        
        
            | 
            | 
           107 | 
             - \core_search\area\base has been renamed to \core_search\base
  | 
        
        
            | 
            | 
           108 | 
             - \core_search\area\base_mod has been renamed to \core_search\base_mod
  | 
        
        
            | 
            | 
           109 | 
             - \core_search\area\base_activity has been renamed to \core_search\base_activity
  |