Skip to content

Commit

Permalink
Add unified search toggle in config
Browse files Browse the repository at this point in the history
The new global search UI is new and might be unstable, hence
we are giving users the option to use the old unified search UI, if
the encounter signficant bottlenecks.

Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
  • Loading branch information
Fenn-CS committed Nov 9, 2023
1 parent 6543009 commit cd24eac
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
7 changes: 7 additions & 0 deletions config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -2395,4 +2395,11 @@
* Defaults to ``true``
*/
'reference_opengraph' => true,

/**
* Enable use of old unified search
*
* Defaults to ``false``
*/
'unified_search.enabled' => false,
];
18 changes: 12 additions & 6 deletions lib/private/TemplateLayout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand Down

0 comments on commit cd24eac

Please sign in to comment.