Commit 541f24c2 authored by catch's avatar catch

Issue #1559244 by Xano, jhodgdon: Clean up search settings page.

parent 3e27ebde
......@@ -126,73 +126,71 @@ public function buildForm(array $form, array &$form_state) {
$count = format_plural($remaining, 'There is 1 item left to index.', 'There are @count items left to index.');
$percentage = ((int) min(100, 100 * ($total - $remaining) / max(1, $total))) . '%';
$status = '<p><strong>' . $this->t('%percentage of the site has been indexed.', array('%percentage' => $percentage)) . ' ' . $count . '</strong></p>';
$form['status'] = array(
$form['indexing'] = array(
'#type' => 'details',
'#title' => $this->t('Indexing status'),
);
$form['status']['status'] = array('#markup' => $status);
$form['status']['wipe'] = array(
'#type' => 'submit',
'#value' => $this->t('Re-index site'),
'#submit' => array(array($this, 'searchAdminReindexSubmit')),
'#title' => $this->t('Indexing'),
'#description' => $this->t("If you change settings related to how content is indexed, a re-index will be triggered. Searching will continue to work, but new content will not be indexed until all existing content has been re-indexed."),
);
$items = drupal_map_assoc(array(10, 20, 50, 100, 200, 500));
// Indexing throttle:
$form['indexing_throttle'] = array(
'#type' => 'details',
'#title' => $this->t('Indexing throttle')
);
$form['indexing_throttle']['cron_limit'] = array(
// Indexing throttle.
$form['indexing']['cron_limit'] = array(
'#type' => 'select',
'#title' => $this->t('Number of items to index per cron run'),
'#default_value' => $this->searchSettings->get('index.cron_limit'),
'#options' => $items,
'#description' => $this->t('The maximum number of items indexed in each pass of a <a href="@cron">cron maintenance task</a>. If necessary, reduce the number of items to prevent timeouts and memory errors while indexing.', array('@cron' => $this->url('system.status')))
);
// Indexing settings:
$form['indexing_settings'] = array(
'#type' => 'details',
'#title' => $this->t('Indexing settings')
'#description' => $this->t('The maximum number of items indexed during a <a href="@cron">cron maintenance task</a>. If necessary, reduce the number of items to prevent timeouts and memory errors while indexing.', array('@cron' => $this->url('system.cron_settings')))
);
$form['indexing_settings']['info'] = array(
'#markup' => $this->t('<p><em>Changing the settings below will cause the site index to be rebuilt. The search index is not cleared but systematically updated to reflect the new settings. Searching will continue to work but new content won\'t be indexed until all existing content has been re-indexed.</em></p><p><em>The default settings should be appropriate for the majority of sites.</em></p>')
);
$form['indexing_settings']['minimum_word_size'] = array(
// Indexing settings.
$form['indexing']['minimum_word_size'] = array(
'#type' => 'number',
'#title' => $this->t('Minimum word length to index'),
'#title' => $this->t('Minimum word length'),
'#default_value' => $this->searchSettings->get('index.minimum_word_size'),
'#min' => 1,
'#max' => 1000,
'#description' => $this->t('The number of characters a word has to be to be indexed. A lower setting means better search result ranking, but also a larger database. Each search query must contain at least one keyword that is this size (or longer).')
'#description' => $this->t('Words shorter than this length will be ignored in search indexing and searching. A lower setting will result in a larger search database. Each search must contain a keyword that has at least this many characters.')
);
$form['indexing_settings']['overlap_cjk'] = array(
$form['indexing']['overlap_cjk'] = array(
'#type' => 'checkbox',
'#title' => $this->t('Simple CJK handling'),
'#title' => $this->t('Simple Chinese/Japanese/Korean handling'),
'#default_value' => $this->searchSettings->get('index.overlap_cjk'),
'#description' => $this->t('Whether to apply a simple Chinese/Japanese/Korean tokenizer based on overlapping sequences. Turn this off if you want to use an external preprocessor for this instead. Does not affect other languages.')
'#description' => $this->t('Apply a tokenizer based on overlapping sequences; the alternative is using an external preprocessor. Does not affect other languages.')
);
$form['active'] = array(
$form['indexing']['status'] = array(
'#markup' => $status,
);
$form['indexing']['wipe'] = array(
'#type' => 'submit',
'#value' => $this->t('Re-index site'),
'#submit' => array(array($this, 'searchAdminReindexSubmit')),
);
$form['plugins'] = array(
'#type' => 'details',
'#title' => $this->t('Active search plugins')
'#title' => $this->t('Search plugins')
);
$options = $this->getOptions();
$form['active']['active_plugins'] = array(
$form['plugins']['active_plugins'] = array(
'#type' => 'checkboxes',
'#title' => $this->t('Active plugins'),
'#title_display' => 'invisible',
'#default_value' => $this->searchSettings->get('active_plugins'),
'#options' => $options,
'#description' => $this->t('Choose which search plugins are active from the available plugins.')
'#required' => TRUE,
);
$form['active']['default_plugin'] = array(
'#title' => $this->t('Default search plugin'),
$form['plugins']['default_plugin'] = array(
'#title' => $this->t('Default plugin'),
'#required' => TRUE,
'#type' => 'radios',
'#default_value' => $this->searchSettings->get('default_plugin'),
'#options' => $options,
'#description' => $this->t('Choose which search plugin is the default.')
);
// Per plugin settings.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment