From d79d85ddd2899ed838030c7149baf09cec1a2b6c Mon Sep 17 00:00:00 2001 From: Benjamin Gaussorgues Date: Wed, 15 Nov 2023 17:00:18 +0100 Subject: Undeprecate getTerm Signed-off-by: Benjamin Gaussorgues --- lib/public/Search/ISearchQuery.php | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/public') diff --git a/lib/public/Search/ISearchQuery.php b/lib/public/Search/ISearchQuery.php index 56f1f1f0faa..75d95b45c4c 100644 --- a/lib/public/Search/ISearchQuery.php +++ b/lib/public/Search/ISearchQuery.php @@ -48,7 +48,6 @@ interface ISearchQuery { * * @return string the search term * @since 20.0.0 - * @deprecated 28.0.0 */ public function getTerm(): string; -- cgit v1.2.3 From 72c191df117700d1b01f21afdf4e657f25b68453 Mon Sep 17 00:00:00 2001 From: Benjamin Gaussorgues Date: Wed, 15 Nov 2023 17:24:37 +0100 Subject: Introduce constants for builtin search filters Signed-off-by: Benjamin Gaussorgues --- lib/private/Search/SearchComposer.php | 18 +++++++++--------- lib/public/Search/IFilter.php | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 9 deletions(-) (limited to 'lib/public') 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); } diff --git a/lib/public/Search/IFilter.php b/lib/public/Search/IFilter.php index c4e444e806b..6065622cb71 100644 --- a/lib/public/Search/IFilter.php +++ b/lib/public/Search/IFilter.php @@ -31,6 +31,21 @@ namespace OCP\Search; * @since 28.0.0 */ interface IFilter { + /** @since 28.0.0 */ + public const BUILTIN_TERM = 'term'; + /** @since 28.0.0 */ + public const BUILTIN_SINCE = 'since'; + /** @since 28.0.0 */ + public const BUILTIN_UNTIL = 'until'; + /** @since 28.0.0 */ + public const BUILTIN_PERSON = 'person'; + /** @since 28.0.0 */ + public const BUILTIN_TITLE_ONLY = 'title-only'; + /** @since 28.0.0 */ + public const BUILTIN_PLACES = 'places'; + /** @since 28.0.0 */ + public const BUILTIN_PROVIDER = 'provider'; + /** * Get filter value * -- cgit v1.2.3