From 29dd587d14c7faf561bb731f59dde158a8fc1bed Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Thu, 12 Apr 2018 17:36:48 -0700 Subject: [PATCH] defaultSearchTermOptions tweaks resolves #2737 --- CHANGELOG-v3.md | 1 + src/config/GeneralConfig.php | 20 +++++++------------- src/search/SearchQueryTerm.php | 2 +- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/CHANGELOG-v3.md b/CHANGELOG-v3.md index 59132f641be..cca497e5313 100644 --- a/CHANGELOG-v3.md +++ b/CHANGELOG-v3.md @@ -8,6 +8,7 @@ ### Changed - New sites’ Base URLs now default to `@web/`. - Textual custom fields now ensure that they don’t contain 4+ byte characters. ([#2725](https://github.com/craftcms/cms/issues/2725)) +- It is no longer expected that all of the `defaultSearchTermOptions` config setting options will be set if any of the default option values need to be overridden. ([#2737](https://github.com/craftcms/cms/issues/2737)) ### Fixed - Fixed a bug where the Clear Caches utility was not deleting template caches. ([#2720](https://github.com/craftcms/cms/issues/2720)) diff --git a/src/config/GeneralConfig.php b/src/config/GeneralConfig.php index 2e827671f16..d65d42ee050 100644 --- a/src/config/GeneralConfig.php +++ b/src/config/GeneralConfig.php @@ -181,19 +181,13 @@ class GeneralConfig extends BaseObject /** * @var array The default options that should be applied to each search term. * Options include: - * - `attribute` – The attribute that the term should apply to (e.g. 'title'), if any - * - `exact` – Whether the term must be an exact match (only applies if `attribute` is set) - * - `exclude` – Whether search results should *exclude* records with this term - * - `subLeft` – Whether to include keywords that contain the term, with additional characters before it - * - `subRight` – Whether to include keywords that contain the term, with additional characters after it - */ - public $defaultSearchTermOptions = [ - 'attribute' => null, - 'exact' => false, - 'exclude' => false, - 'subLeft' => false, - 'subRight' => true, - ]; + * - `attribute` – The attribute that the term should apply to (e.g. 'title'), if any. (`null` by default) + * - `exact` – Whether the term must be an exact match (only applies if `attribute` is set). (`false` by default) + * - `exclude` – Whether search results should *exclude* records with this term. (`false` by default) + * - `subLeft` – Whether to include keywords that contain the term, with additional characters before it. (`false` by default) + * - `subRight` – Whether to include keywords that contain the term, with additional characters after it. (`true` by default) + */ + public $defaultSearchTermOptions = []; /** * @var string[] The template file extensions Craft will look for when matching a template path to a file on the front end. */ diff --git a/src/search/SearchQueryTerm.php b/src/search/SearchQueryTerm.php index 9bb549e9a7b..07d5cd2aa6d 100644 --- a/src/search/SearchQueryTerm.php +++ b/src/search/SearchQueryTerm.php @@ -39,7 +39,7 @@ class SearchQueryTerm extends BaseObject /** * @var bool */ - public $subRight = false; + public $subRight = true; /** * @var null