diff options
author | Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com> | 2024-02-27 10:43:06 +0100 |
---|---|---|
committer | Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com> | 2024-02-27 10:43:06 +0100 |
commit | f3b5c7caf3dbdb2c5ad53bd203c98d24fecd648d (patch) | |
tree | dee129cb9e393c859336aac3951f34960c302461 /apps | |
parent | 2ae5bdba891818792819040b9218a26dec68e886 (diff) | |
download | nextcloud-server-f3b5c7caf3dbdb2c5ad53bd203c98d24fecd648d.tar.gz nextcloud-server-f3b5c7caf3dbdb2c5ad53bd203c98d24fecd648d.zip |
feat(search): allows to search files by path
Use `GET search/providers/files/search?path=<path>` with beginning of
the path
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/lib/Search/FilesSearchProvider.php | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/apps/files/lib/Search/FilesSearchProvider.php b/apps/files/lib/Search/FilesSearchProvider.php index b587fdf32de..43ea5ef09a4 100644 --- a/apps/files/lib/Search/FilesSearchProvider.php +++ b/apps/files/lib/Search/FilesSearchProvider.php @@ -116,6 +116,7 @@ class FilesSearchProvider implements IFilteringProvider { 'max-size', 'mime', 'type', + 'path', 'is-favorite', 'title-only', ]; @@ -131,6 +132,7 @@ class FilesSearchProvider implements IFilteringProvider { new FilterDefinition('max-size', FilterDefinition::TYPE_INT), new FilterDefinition('mime', FilterDefinition::TYPE_STRING), new FilterDefinition('type', FilterDefinition::TYPE_STRING), + new FilterDefinition('path', FilterDefinition::TYPE_STRING), new FilterDefinition('is-favorite', FilterDefinition::TYPE_BOOL), ]; } @@ -182,6 +184,7 @@ class FilesSearchProvider implements IFilteringProvider { 'max-size' => new SearchComparison(ISearchComparison::COMPARE_LESS_THAN_EQUAL, 'size', $filter->get()), 'mime' => new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', $filter->get()), 'type' => new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $filter->get() . '/%'), + 'path' => new SearchComparison(ISearchComparison::COMPARE_LIKE, 'path', 'files/' . ltrim($filter->get(), '/') . '%'), 'person' => $this->buildPersonSearchQuery($filter), default => throw new InvalidArgumentException('Unsupported comparison'), }; |