diff --git a/core/modules/search/search.module b/core/modules/search/search.module index 9a0a405..6beb52d 100644 --- a/core/modules/search/search.module +++ b/core/modules/search/search.module @@ -122,6 +122,9 @@ function search_preprocess_block(&$variables) { /** * Clears either a part of, or the entire search index. * + * This function is meant for use by search page plugins, or for building a + * user interface that lets users clear all or parts of the search index. + * * @param $type * (optional) The plugin ID or other machine-readable type for the items to * remove from the search index. If omitted, $sid and $langcode are ignored @@ -501,7 +504,11 @@ function search_index($sid, $type, $text, $langcode) { } /** - * Changes the timestamp on an indexed item to 'now' to force reindexing. + * Changes the timestamp on indexed items to 'now' to force reindexing. + * + * This function is meant for use by search page plugins, or for building a + * user interface that lets users mark all or parts of the search index for + * reindexing. * * @param string $type * (optional) The plugin ID or other machine-readable type of this item. If diff --git a/core/modules/search/src/Plugin/SearchIndexingInterface.php b/core/modules/search/src/Plugin/SearchIndexingInterface.php index 3a09a8e..93aec02 100644 --- a/core/modules/search/src/Plugin/SearchIndexingInterface.php +++ b/core/modules/search/src/Plugin/SearchIndexingInterface.php @@ -15,6 +15,13 @@ * implementing this interface are assumed to be using their own methods for * searching, not involving separate index tables. * + * The user interface for managing search pages displays the indexing status for + * search pages implementing this interface. It also allows users to configure + * default settings for indexing, and refers to the "default search index". If + * your search page plugin uses its own indexing mechanism instead of the + * default search index, or overrides the default indexing settings, you should + * make this clear on the settings page or other documentation for your plugin. + * * Multiple search pages can be created for each search plugin, so you will need * to choose whether these search pages should share an index (in which case * they must not use any search page-specific configuration while indexing) or @@ -32,12 +39,13 @@ * own indexing mechanism. * * When implementing this method, your module should index content items that - * were modified or added since the last run. PHP has a time limit - * for cron, though, so it is advisable to limit how many items you index - * per run using config('search.settings')->get('index.cron_limit'). Also, - * since the cron run could time out and abort in the middle of your run, you - * should update any needed internal bookkeeping on when items have last - * been indexed as you go rather than waiting to the end of indexing. + * were modified or added since the last run. There is a time limit for cron, + * so it is advisable to limit how many items you index per run using + * config('search.settings')->get('index.cron_limit') or with your own + * setting. And since the cron run could time out and abort in the middle of + * your run, you should update any needed internal bookkeeping on when items + * have last been indexed as you go rather than waiting to the end of + * indexing. */ public function updateIndex(); @@ -45,7 +53,7 @@ public function updateIndex(); * Clears the search index for this plugin. * * When a request is made to clear all items from the search index related to - * this plugin, this method will be called. If this plugin uses the Core + * this plugin, this method will be called. If this plugin uses the default * search index, this method can call search_index_clear($type) to remove * indexed items from the search database. * @@ -58,8 +66,9 @@ public function indexClear(); * * When a request is made to mark all items from the search index related to * this plugin for reindexing, this method will be called. If this plugin uses - * the Core search index, this method can call search_mark_for_reindex($type) - * to mark the items in the search database for reindexing. + * the default search index, this method can call + * search_mark_for_reindex($type) to mark the items in the search database for + * reindexing. * * @see search_mark_for_reindex() */ diff --git a/core/modules/search/src/SearchPageListBuilder.php b/core/modules/search/src/SearchPageListBuilder.php index 56d5868..af7f239 100644 --- a/core/modules/search/src/SearchPageListBuilder.php +++ b/core/modules/search/src/SearchPageListBuilder.php @@ -202,16 +202,16 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#title' => $this->t('Number of items to index per cron run'), '#default_value' => $search_settings->get('index.cron_limit'), '#options' => $items, - '#description' => $this->t('The maximum number of items indexed in each pass of a cron maintenance task. If necessary, reduce the number of items to prevent timeouts and memory errors while indexing.', array('@cron' => url('admin/reports/status'))), + '#description' => $this->t('The maximum number of items indexed in each pass of a cron maintenance task. If necessary, reduce the number of items to prevent timeouts and memory errors while indexing. Some search page types may have their own setting for this', array('@cron' => url('admin/reports/status'))), ); // Indexing settings: $form['indexing_settings'] = array( '#type' => 'details', - '#title' => $this->t('Indexing settings for default index'), + '#title' => $this->t('Default indexing settings'), '#open' => TRUE, ); $form['indexing_settings']['info'] = array( - '#markup' => $this->t("
The settings below are for search pages that use the default search index. Changing these settings will cause the default search index to be rebuilt to reflect the new settings. Searching will continue to work, based on the existing index, but new content won't be indexed until all existing content has been re-indexed.
The default settings should be appropriate for the majority of sites.
") + '#markup' => $this->t("Search pages that use an index may use the default index provided by the Search module, or they may use a different indexing mechanism. These settings are for the default index. Changing these settings will cause the default search index to be rebuilt to reflect the new settings. Searching will continue to work, based on the existing index, but new content won't be indexed until all existing content has been re-indexed.
The default settings should be appropriate for the majority of sites.
") ); $form['indexing_settings']['minimum_word_size'] = array( '#type' => 'number', @@ -329,11 +329,11 @@ public function submitForm(array &$form, FormStateInterface $form_state) { parent::submitForm($form, $form_state); $search_settings = $this->configFactory->get('search.settings'); - // If these settings change, the Core index needs to be rebuilt. + // If these settings change, the default index needs to be rebuilt. if (($search_settings->get('index.minimum_word_size') != $form_state->getValue('minimum_word_size')) || ($search_settings->get('index.overlap_cjk') != $form_state->getValue('overlap_cjk'))) { $search_settings->set('index.minimum_word_size', $form_state->getValue('minimum_word_size')); $search_settings->set('index.overlap_cjk', $form_state->getValue('overlap_cjk')); - // Specifically mark items in the Core index for reindexing, since + // Specifically mark items in the default index for reindexing, since // these settings are used in the search_index() function. drupal_set_message($this->t('The default search index will be rebuilt.')); search_mark_for_reindex();