diff --git a/config/config.sample.php b/config/config.sample.php index 9043dbd00aa35..ab86feedb8520 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -2395,4 +2395,11 @@ * Defaults to ``true`` */ 'reference_opengraph' => true, + +/** + * Enable use of old unified search + * + * Defaults to ``false`` + */ +'unified_search.enabled' => false, ]; diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php index 90ca935974074..011597e6c29c5 100644 --- a/lib/private/TemplateLayout.php +++ b/lib/private/TemplateLayout.php @@ -106,12 +106,18 @@ public function __construct($renderAs, $appId = '') { $this->initialState->provideInitialState('core', 'active-app', $this->navigationManager->getActiveEntry()); $this->initialState->provideInitialState('core', 'apps', $this->navigationManager->getAll()); - $this->initialState->provideInitialState('unified-search', 'limit-default', (int)$this->config->getAppValue('core', 'unified-search.limit-default', (string)SearchQuery::LIMIT_DEFAULT)); - $this->initialState->provideInitialState('unified-search', 'min-search-length', (int)$this->config->getAppValue('core', 'unified-search.min-search-length', (string)1)); - $this->initialState->provideInitialState('unified-search', 'live-search', $this->config->getAppValue('core', 'unified-search.live-search', 'yes') === 'yes'); - Util::addScript('core', 'unified-search', 'core'); - Util::addScript('core', 'global-search', 'core'); - + /* + * NB : Unified search enabled, defaults to true since new advanced search is + * unstable. Once we think otherwise, the default should be false. + */ + if ($this->config->getSystemValueBool('unified_search.enabled', true)) { + $this->initialState->provideInitialState('unified-search', 'limit-default', (int)$this->config->getAppValue('core', 'unified-search.limit-default', (string)SearchQuery::LIMIT_DEFAULT)); + $this->initialState->provideInitialState('unified-search', 'min-search-length', (int)$this->config->getAppValue('core', 'unified-search.min-search-length', (string)1)); + $this->initialState->provideInitialState('unified-search', 'live-search', $this->config->getAppValue('core', 'unified-search.live-search', 'yes') === 'yes'); + Util::addScript('core', 'unified-search', 'core'); + } else { + Util::addScript('core', 'global-search', 'core'); + } // Set body data-theme $this->assign('enabledThemes', []); if (\OC::$server->getAppManager()->isEnabledForUser('theming') && class_exists('\OCA\Theming\Service\ThemesService')) {