From b020dc2921ef1aaa78ebde9f7569873c98118283 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 14 Jul 2015 08:52:53 +0100 Subject: [PATCH] Issue #2513586 by kfitz, cilefen, jhodgdon, Bojhan, eliza411, ivanstegic, LewisNyman, lunk_rat, nickrosencrans, stpaultim, webchick: Remove the word "positive" from the "Must include a positive keyword with three characters or more." error message --- core/modules/node/src/Plugin/Search/NodeSearch.php | 2 +- core/modules/search/src/Plugin/views/filter/Search.php | 2 +- core/modules/search/src/Tests/SearchBlockTest.php | 6 +++--- core/modules/search/src/Tests/SearchNodePunctuationTest.php | 4 ++-- core/modules/search/src/Tests/SearchPageTextTest.php | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/modules/node/src/Plugin/Search/NodeSearch.php b/core/modules/node/src/Plugin/Search/NodeSearch.php index 9dc4442ca2f..d787cb513f2 100644 --- a/core/modules/node/src/Plugin/Search/NodeSearch.php +++ b/core/modules/node/src/Plugin/Search/NodeSearch.php @@ -293,7 +293,7 @@ class NodeSearch extends ConfigurableSearchPluginBase implements AccessibleInter } if ($status & SearchQuery::NO_POSITIVE_KEYWORDS) { - drupal_set_message($this->formatPlural($this->searchSettings->get('index.minimum_word_size'), 'You must include at least one positive keyword with 1 character or more.', 'You must include at least one positive keyword with @count characters or more.'), 'warning'); + drupal_set_message($this->formatPlural($this->searchSettings->get('index.minimum_word_size'), 'You must include at least one keyword to match in the content, and punctuation is ignored.', 'You must include at least one keyword to match in the content. Keywords must be at least @count characters, and punctuation is ignored.'), 'warning'); } return $find; diff --git a/core/modules/search/src/Plugin/views/filter/Search.php b/core/modules/search/src/Plugin/views/filter/Search.php index d675a29abba..844a0b2cd20 100644 --- a/core/modules/search/src/Plugin/views/filter/Search.php +++ b/core/modules/search/src/Plugin/views/filter/Search.php @@ -108,7 +108,7 @@ class Search extends FilterPluginBase { if (!$form_state->isValueEmpty($key)) { $this->queryParseSearchExpression($form_state->getValue($key)); if (count($this->searchQuery->words()) == 0) { - $form_state->setErrorByName($key, $this->formatPlural(\Drupal::config('search.settings')->get('index.minimum_word_size'), 'You must include at least one positive keyword with 1 character or more.', 'You must include at least one positive keyword with @count characters or more.')); + $form_state->setErrorByName($key, $this->formatPlural(\Drupal::config('search.settings')->get('index.minimum_word_size'), 'You must include at least one keyword to match in the content, and punctuation is ignored.', 'You must include at least one keyword to match in the content. Keywords must be at least @count characters, and punctuation is ignored.')); } } } diff --git a/core/modules/search/src/Tests/SearchBlockTest.php b/core/modules/search/src/Tests/SearchBlockTest.php index 4b774a12260..8351878e22a 100644 --- a/core/modules/search/src/Tests/SearchBlockTest.php +++ b/core/modules/search/src/Tests/SearchBlockTest.php @@ -93,16 +93,16 @@ class SearchBlockTest extends SearchTestBase { // Test that after entering a too-short keyword in the form, you can then // search again with a longer keyword. First test using the block form. $this->submitGetForm('node', array('keys' => $this->randomMachineName(1)), t('Search')); - $this->assertText('You must include at least one positive keyword', 'Keyword message is displayed when searching for short word'); + $this->assertText('You must include at least one keyword to match in the content', 'Keyword message is displayed when searching for short word'); $this->assertNoText(t('Please enter some keywords'), 'With short word entered, no keywords message is not displayed'); $this->submitGetForm(NULL, array('keys' => $this->randomMachineName()), t('Search'), 'search-block-form'); - $this->assertNoText('You must include at least one positive keyword', 'Keyword message is not displayed when searching for long word after short word search'); + $this->assertNoText('You must include at least one keyword to match in the content', 'Keyword message is not displayed when searching for long word after short word search'); // Same test again, using the search page form for the second search this // time. $this->submitGetForm('node', array('keys' => $this->randomMachineName(1)), t('Search')); $this->drupalPostForm(NULL, array('keys' => $this->randomMachineName()), t('Search'), array(), array(), 'search-form'); - $this->assertNoText('You must include at least one positive keyword', 'Keyword message is not displayed when searching for long word after short word search'); + $this->assertNoText('You must include at least one keyword to match in the content', 'Keyword message is not displayed when searching for long word after short word search'); } diff --git a/core/modules/search/src/Tests/SearchNodePunctuationTest.php b/core/modules/search/src/Tests/SearchNodePunctuationTest.php index 23e95a4aebb..3c32997c4ba 100644 --- a/core/modules/search/src/Tests/SearchNodePunctuationTest.php +++ b/core/modules/search/src/Tests/SearchNodePunctuationTest.php @@ -57,11 +57,11 @@ class SearchNodePunctuationTest extends SearchTestBase { $edit = array('keys' => '&'); $this->drupalPostForm('search/node', $edit, t('Search')); $this->assertNoRaw('&'); - $this->assertText('You must include at least one positive keyword'); + $this->assertText('You must include at least one keyword'); $edit = array('keys' => '&'); $this->drupalPostForm('search/node', $edit, t('Search')); $this->assertNoRaw('&'); - $this->assertText('You must include at least one positive keyword'); + $this->assertText('You must include at least one keyword'); } } diff --git a/core/modules/search/src/Tests/SearchPageTextTest.php b/core/modules/search/src/Tests/SearchPageTextTest.php index d973ffc5ed7..ad311d6f69e 100644 --- a/core/modules/search/src/Tests/SearchPageTextTest.php +++ b/core/modules/search/src/Tests/SearchPageTextTest.php @@ -119,10 +119,10 @@ class SearchPageTextTest extends SearchTestBase { // message, and that if after that you search for a longer keyword, you // do not still see the message. $this->drupalPostForm('search/node', array('keys' => $this->randomMachineName(1)), t('Search')); - $this->assertText('You must include at least one positive keyword', 'Keyword message is displayed when searching for short word'); + $this->assertText('You must include at least one keyword', 'Keyword message is displayed when searching for short word'); $this->assertNoText(t('Please enter some keywords'), 'With short word entered, no keywords message is not displayed'); $this->drupalPostForm(NULL, array('keys' => $this->randomMachineName()), t('Search')); - $this->assertNoText('You must include at least one positive keyword', 'Keyword message is not displayed when searching for long word after short word search'); + $this->assertNoText('You must include at least one keyword', 'Keyword message is not displayed when searching for long word after short word search'); // Test that if you search for a URL with .. in it, you still end up at // the search page. See issue https://www.drupal.org/node/890058.