diff options
author | Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com> | 2023-11-15 17:24:37 +0100 |
---|---|---|
committer | Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com> | 2023-11-15 17:24:37 +0100 |
commit | 72c191df117700d1b01f21afdf4e657f25b68453 (patch) | |
tree | f6149d9c0b722279bfae50f21b2fafd6ecb61062 /lib/private/Search/SearchComposer.php | |
parent | d79d85ddd2899ed838030c7149baf09cec1a2b6c (diff) | |
download | nextcloud-server-72c191df117700d1b01f21afdf4e657f25b68453.tar.gz nextcloud-server-72c191df117700d1b01f21afdf4e657f25b68453.zip |
Introduce constants for builtin search filters
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
Diffstat (limited to 'lib/private/Search/SearchComposer.php')
-rw-r--r-- | lib/private/Search/SearchComposer.php | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/private/Search/SearchComposer.php b/lib/private/Search/SearchComposer.php index b92fdd250d8..b20d47aa94e 100644 --- a/lib/private/Search/SearchComposer.php +++ b/lib/private/Search/SearchComposer.php @@ -81,13 +81,13 @@ class SearchComposer { private LoggerInterface $logger ) { $this->commonFilters = [ - 'term' => new FilterDefinition('term', FilterDefinition::TYPE_STRING), - 'since' => new FilterDefinition('since', FilterDefinition::TYPE_DATETIME), - 'until' => new FilterDefinition('until', FilterDefinition::TYPE_DATETIME), - 'title-only' => new FilterDefinition('title-only', FilterDefinition::TYPE_BOOL, false), - 'person' => new FilterDefinition('person', FilterDefinition::TYPE_PERSON), - 'places' => new FilterDefinition('places', FilterDefinition::TYPE_STRINGS, false), - 'provider' => new FilterDefinition('provider', FilterDefinition::TYPE_STRING, false), + IFilter::BUILTIN_TERM => new FilterDefinition(IFilter::BUILTIN_TERM, FilterDefinition::TYPE_STRING), + IFilter::BUILTIN_SINCE => new FilterDefinition(IFilter::BUILTIN_SINCE, FilterDefinition::TYPE_DATETIME), + IFilter::BUILTIN_UNTIL => new FilterDefinition(IFilter::BUILTIN_UNTIL, FilterDefinition::TYPE_DATETIME), + IFilter::BUILTIN_TITLE_ONLY => new FilterDefinition(IFilter::BUILTIN_TITLE_ONLY, FilterDefinition::TYPE_BOOL, false), + IFilter::BUILTIN_PERSON => new FilterDefinition(IFilter::BUILTIN_PERSON, FilterDefinition::TYPE_PERSON), + IFilter::BUILTIN_PLACES => new FilterDefinition(IFilter::BUILTIN_PLACES, FilterDefinition::TYPE_STRINGS, false), + IFilter::BUILTIN_PROVIDER => new FilterDefinition(IFilter::BUILTIN_PROVIDER, FilterDefinition::TYPE_STRING, false), ]; } @@ -189,7 +189,7 @@ class SearchComposer { $triggers += $provider->getAlternateIds(); $filters = $provider->getSupportedFilters(); } else { - $filters = ['term']; + $filters = [IFilter::BUILTIN_TERM]; } return [ @@ -310,7 +310,7 @@ class SearchComposer { $provider = $this->providers[$providerId]['provider']; $supportedFilters = $provider instanceof IFilteringProvider ? $provider->getSupportedFilters() - : ['term']; + : [IFilter::BUILTIN_TERM]; return in_array($filterDefinition->name(), $supportedFilters, true); } |