aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2024-06-18 13:42:26 +0200
committerJulius Härtl <jus@bitgrid.net>2024-08-01 12:33:18 +0200
commita6d421e76735982c28e9094d3c23d616cce47296 (patch)
treeb173d70a5a1b3f30fd419d7937952048ccbcbf9e
parentc52b7e5ebc6736de2d9991af379e4ed9885aab7b (diff)
downloadnextcloud-server-a6d421e76735982c28e9094d3c23d616cce47296.tar.gz
nextcloud-server-a6d421e76735982c28e9094d3c23d616cce47296.zip
chore: Remove deprecated legacy search backend
Signed-off-by: Julius Härtl <jus@bitgrid.net>
-rw-r--r--apps/comments/lib/AppInfo/Application.php3
-rw-r--r--apps/files/lib/AppInfo/Application.php7
-rw-r--r--build/integration/comments_features/comments-search.feature273
-rw-r--r--core/Controller/SearchController.php46
-rw-r--r--lib/composer/composer/autoload_classmap.php8
-rw-r--r--lib/composer/composer/autoload_static.php8
-rw-r--r--lib/private/Search.php100
-rw-r--r--lib/private/Search/Provider/File.php87
-rw-r--r--lib/private/Search/Result/Audio.php25
-rw-r--r--lib/private/Search/Result/File.php132
-rw-r--r--lib/private/Search/Result/Folder.php21
-rw-r--r--lib/private/Search/Result/Image.php25
-rw-r--r--lib/private/Server.php15
-rw-r--r--lib/public/ISearch.php51
-rw-r--r--lib/public/IServerContainer.php9
-rw-r--r--tests/lib/ServerTest.php2
16 files changed, 0 insertions, 812 deletions
diff --git a/apps/comments/lib/AppInfo/Application.php b/apps/comments/lib/AppInfo/Application.php
index 15b576938d2..f0a7b063c9a 100644
--- a/apps/comments/lib/AppInfo/Application.php
+++ b/apps/comments/lib/AppInfo/Application.php
@@ -13,7 +13,6 @@ use OCA\Comments\Listener\LoadSidebarScripts;
use OCA\Comments\MaxAutoCompleteResultsInitialState;
use OCA\Comments\Notification\Notifier;
use OCA\Comments\Search\CommentsSearchProvider;
-use OCA\Comments\Search\LegacyProvider;
use OCA\Files\Event\LoadAdditionalScriptsEvent;
use OCA\Files\Event\LoadSidebar;
use OCP\AppFramework\App;
@@ -22,7 +21,6 @@ use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\Comments\CommentsEntityEvent;
use OCP\Comments\CommentsEvent;
-use OCP\ISearch;
class Application extends App implements IBootstrap {
public const APP_ID = 'comments';
@@ -59,6 +57,5 @@ class Application extends App implements IBootstrap {
}
public function boot(IBootContext $context): void {
- $context->getServerContainer()->get(ISearch::class)->registerProvider(LegacyProvider::class, ['apps' => ['files']]);
}
}
diff --git a/apps/files/lib/AppInfo/Application.php b/apps/files/lib/AppInfo/Application.php
index b4fd04c9fbc..de0542c8ad3 100644
--- a/apps/files/lib/AppInfo/Application.php
+++ b/apps/files/lib/AppInfo/Application.php
@@ -9,7 +9,6 @@ declare(strict_types=1);
namespace OCA\Files\AppInfo;
use Closure;
-use OC\Search\Provider\File;
use OCA\Files\Capabilities;
use OCA\Files\Collaboration\Resources\Listener;
use OCA\Files\Collaboration\Resources\ResourceProvider;
@@ -45,7 +44,6 @@ use OCP\Files\Events\Node\NodeCopiedEvent;
use OCP\IConfig;
use OCP\IPreview;
use OCP\IRequest;
-use OCP\ISearch;
use OCP\IServerContainer;
use OCP\ITagManager;
use OCP\IUserSession;
@@ -127,7 +125,6 @@ class Application extends App implements IBootstrap {
public function boot(IBootContext $context): void {
$context->injectFn(Closure::fromCallable([$this, 'registerCollaboration']));
$context->injectFn([Listener::class, 'register']);
- $context->injectFn(Closure::fromCallable([$this, 'registerSearchProvider']));
$this->registerTemplates();
$this->registerHooks();
}
@@ -136,10 +133,6 @@ class Application extends App implements IBootstrap {
$providerManager->registerResourceProvider(ResourceProvider::class);
}
- private function registerSearchProvider(ISearch $search): void {
- $search->registerProvider(File::class, ['apps' => ['files']]);
- }
-
private function registerTemplates(): void {
$templateManager = \OC_Helper::getFileTemplateManager();
$templateManager->registerTemplate('application/vnd.oasis.opendocument.presentation', 'core/templates/filetemplates/template.odp');
diff --git a/build/integration/comments_features/comments-search.feature b/build/integration/comments_features/comments-search.feature
deleted file mode 100644
index 19802dd2182..00000000000
--- a/build/integration/comments_features/comments-search.feature
+++ /dev/null
@@ -1,273 +0,0 @@
-# SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
-# SPDX-License-Identifier: AGPL-3.0-or-later
-Feature: comments-search
-
- Scenario: Search my own comment on a file belonging to myself
- Given user "user0" exists
- And User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
- And "user0" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
- When Logging in using web as "user0"
- And searching for "first" in app "files"
- Then the list of search results has "1" results
- And search result "0" contains
- | type | comment |
- | comment | My first comment |
- | authorId | user0 |
- | authorName | user0 |
- | path | myFileToComment.txt |
- | fileName | myFileToComment.txt |
- | name | My first comment |
-
- Scenario: Search my own comment on a file shared by someone with me
- Given user "user0" exists
- And user "user1" exists
- And User "user1" uploads file "data/textfile.txt" to "/sharedFileToComment.txt"
- And as "user1" creating a share with
- | path | sharedFileToComment.txt |
- | shareWith | user0 |
- | shareType | 0 |
- And user "user0" accepts last share
- And "user0" posts a comment with content "My first comment" on the file named "/sharedFileToComment.txt" it should return "201"
- When Logging in using web as "user0"
- And searching for "first" in app "files"
- Then the list of search results has "1" results
- And search result "0" contains
- | type | comment |
- | comment | My first comment |
- | authorId | user0 |
- | authorName | user0 |
- | path | sharedFileToComment.txt |
- | fileName | sharedFileToComment.txt |
- | name | My first comment |
-
- Scenario: Search other user's comment on a file shared by me
- Given user "user0" exists
- And user "user1" exists
- And User "user0" uploads file "data/textfile.txt" to "/mySharedFileToComment.txt"
- And as "user0" creating a share with
- | path | mySharedFileToComment.txt |
- | shareWith | user1 |
- | shareType | 0 |
- And user "user1" accepts last share
- And "user1" posts a comment with content "Other's first comment" on the file named "/mySharedFileToComment.txt" it should return "201"
- When Logging in using web as "user0"
- And searching for "first" in app "files"
- Then the list of search results has "1" results
- And search result "0" contains
- | type | comment |
- | comment | Other's first comment |
- | authorId | user1 |
- | authorName | user1 |
- | path | mySharedFileToComment.txt |
- | fileName | mySharedFileToComment.txt |
- | name | Other's first comment |
-
- Scenario: Search other user's comment on a file shared by someone with me
- Given user "user0" exists
- And user "user1" exists
- And User "user1" uploads file "data/textfile.txt" to "/sharedFileToComment.txt"
- And as "user1" creating a share with
- | path | sharedFileToComment.txt |
- | shareWith | user0 |
- | shareType | 0 |
- And user "user0" accepts last share
- And "user1" posts a comment with content "Other's first comment" on the file named "/sharedFileToComment.txt" it should return "201"
- When Logging in using web as "user0"
- And searching for "first" in app "files"
- Then the list of search results has "1" results
- And search result "0" contains
- | type | comment |
- | comment | Other's first comment |
- | authorId | user1 |
- | authorName | user1 |
- | path | sharedFileToComment.txt |
- | fileName | sharedFileToComment.txt |
- | name | Other's first comment |
-
- Scenario: Search several comments on a file belonging to myself
- Given user "user0" exists
- And User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
- And "user0" posts a comment with content "My first comment to be found" on the file named "/myFileToComment.txt" it should return "201"
- And "user0" posts a comment with content "The second comment should not be found" on the file named "/myFileToComment.txt" it should return "201"
- And "user0" posts a comment with content "My third comment to be found" on the file named "/myFileToComment.txt" it should return "201"
- When Logging in using web as "user0"
- And searching for "comment to be found" in app "files"
- Then the list of search results has "2" results
- And search result "0" contains
- | type | comment |
- | comment | My third comment to be found |
- | authorId | user0 |
- | authorName | user0 |
- | path | myFileToComment.txt |
- | fileName | myFileToComment.txt |
- | name | My third comment to be found |
- And search result "1" contains
- | type | comment |
- | comment | My first comment to be found |
- | authorId | user0 |
- | authorName | user0 |
- | path | myFileToComment.txt |
- | fileName | myFileToComment.txt |
- | name | My first comment to be found |
-
- Scenario: Search comment with a large message ellipsized on the right
- Given user "user0" exists
- And User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
- And "user0" posts a comment with content "A very verbose message that is meant to be used to test the ellipsized message returned when searching for long comments" on the file named "/myFileToComment.txt" it should return "201"
- When Logging in using web as "user0"
- And searching for "verbose" in app "files"
- Then the list of search results has "1" results
- And search result "0" contains
- | type | comment |
- | comment | A very verbose message that is meant to… |
- | authorId | user0 |
- | authorName | user0 |
- | path | myFileToComment.txt |
- | fileName | myFileToComment.txt |
- | name | A very verbose message that is meant to be used to test the ellipsized message returned when searching for long comments |
-
- Scenario: Search comment with a large message ellipsized on the left
- Given user "user0" exists
- And User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
- And "user0" posts a comment with content "A very verbose message that is meant to be used to test the ellipsized message returned when searching for long comments" on the file named "/myFileToComment.txt" it should return "201"
- When Logging in using web as "user0"
- And searching for "searching" in app "files"
- Then the list of search results has "1" results
- And search result "0" contains
- | type | comment |
- | comment | …ed message returned when searching for long comments |
- | authorId | user0 |
- | authorName | user0 |
- | path | myFileToComment.txt |
- | fileName | myFileToComment.txt |
- | name | A very verbose message that is meant to be used to test the ellipsized message returned when searching for long comments |
-
- Scenario: Search comment with a large message ellipsized on both ends
- Given user "user0" exists
- And User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
- And "user0" posts a comment with content "A very verbose message that is meant to be used to test the ellipsized message returned when searching for long comments" on the file named "/myFileToComment.txt" it should return "201"
- When Logging in using web as "user0"
- And searching for "ellipsized" in app "files"
- Then the list of search results has "1" results
- And search result "0" contains
- | type | comment |
- | comment | …t to be used to test the ellipsized message returned when se… |
- | authorId | user0 |
- | authorName | user0 |
- | path | myFileToComment.txt |
- | fileName | myFileToComment.txt |
- | name | A very verbose message that is meant to be used to test the ellipsized message returned when searching for long comments |
-
- Scenario: Search comment on a file in a subfolder
- Given user "user0" exists
- And user "user0" created a folder "/subfolder"
- And User "user0" uploads file "data/textfile.txt" to "/subfolder/myFileToComment.txt"
- And "user0" posts a comment with content "My first comment" on the file named "/subfolder/myFileToComment.txt" it should return "201"
- When Logging in using web as "user0"
- And searching for "first" in app "files"
- Then the list of search results has "1" results
- And search result "0" contains
- | type | comment |
- | comment | My first comment |
- | authorId | user0 |
- | authorName | user0 |
- | path | subfolder/myFileToComment.txt |
- | fileName | myFileToComment.txt |
- | name | My first comment |
-
- Scenario: Search several comments
- Given user "user0" exists
- And user "user1" exists
- And User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
- And User "user0" uploads file "data/textfile.txt" to "/mySharedFileToComment.txt"
- And as "user0" creating a share with
- | path | mySharedFileToComment.txt |
- | shareWith | user1 |
- | shareType | 0 |
- And user "user1" accepts last share
- And User "user1" uploads file "data/textfile.txt" to "/sharedFileToComment.txt"
- And as "user1" creating a share with
- | path | sharedFileToComment.txt |
- | shareWith | user0 |
- | shareType | 0 |
- And user "user0" accepts last share
- And "user0" posts a comment with content "My first comment to be found" on the file named "/myFileToComment.txt" it should return "201"
- And "user0" posts a comment with content "The second comment should not be found" on the file named "/myFileToComment.txt" it should return "201"
- And "user0" posts a comment with content "My first comment to be found" on the file named "/mySharedFileToComment.txt" it should return "201"
- And "user1" posts a comment with content "Other's first comment that should not be found" on the file named "/mySharedFileToComment.txt" it should return "201"
- And "user1" posts a comment with content "Other's second comment to be found" on the file named "/mySharedFileToComment.txt" it should return "201"
- And "user0" posts a comment with content "My first comment that should not be found" on the file named "/sharedFileToComment.txt" it should return "201"
- And "user1" posts a comment with content "Other's first comment to be found" on the file named "/sharedFileToComment.txt" it should return "201"
- And "user0" posts a comment with content "My second comment to be found that happens to be more verbose than the others and thus should be ellipsized" on the file named "/sharedFileToComment.txt" it should return "201"
- And "user0" posts a comment with content "My third comment to be found" on the file named "/myFileToComment.txt" it should return "201"
- When Logging in using web as "user0"
- And searching for "comment to be found" in app "files"
- Then the list of search results has "6" results
- And search result "0" contains
- | type | comment |
- | comment | My third comment to be found |
- | authorId | user0 |
- | authorName | user0 |
- | path | myFileToComment.txt |
- | fileName | myFileToComment.txt |
- | name | My third comment to be found |
- And search result "1" contains
- | type | comment |
- | comment | My second comment to be found that happens to be more … |
- | authorId | user0 |
- | authorName | user0 |
- | path | sharedFileToComment.txt |
- | fileName | sharedFileToComment.txt |
- | name | My second comment to be found that happens to be more verbose than the others and thus should be ellipsized |
- And search result "2" contains
- | type | comment |
- | comment | Other's first comment to be found |
- | authorId | user1 |
- | authorName | user1 |
- | path | sharedFileToComment.txt |
- | fileName | sharedFileToComment.txt |
- | name | Other's first comment to be found |
- And search result "3" contains
- | type | comment |
- | comment | Other's second comment to be found |
- | authorId | user1 |
- | authorName | user1 |
- | path | mySharedFileToComment.txt |
- | fileName | mySharedFileToComment.txt |
- | name | Other's second comment to be found |
- And search result "4" contains
- | type | comment |
- | comment | My first comment to be found |
- | authorId | user0 |
- | authorName | user0 |
- | path | mySharedFileToComment.txt |
- | fileName | mySharedFileToComment.txt |
- | name | My first comment to be found |
- And search result "5" contains
- | type | comment |
- | comment | My first comment to be found |
- | authorId | user0 |
- | authorName | user0 |
- | path | myFileToComment.txt |
- | fileName | myFileToComment.txt |
- | name | My first comment to be found |
-
- Scenario: Search comment with a query that also matches a file name
- Given user "user0" exists
- And User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
- And "user0" posts a comment with content "A comment in myFileToComment.txt" on the file named "/myFileToComment.txt" it should return "201"
- When Logging in using web as "user0"
- And searching for "myFileToComment" in app "files"
- Then the list of search results has "2" results
- And search result "0" contains
- | type | file |
- | path | /myFileToComment.txt |
- | name | myFileToComment.txt |
- And search result "1" contains
- | type | comment |
- | comment | A comment in myFileToComment.txt |
- | authorId | user0 |
- | authorName | user0 |
- | path | myFileToComment.txt |
- | fileName | myFileToComment.txt |
- | name | A comment in myFileToComment.txt |
diff --git a/core/Controller/SearchController.php b/core/Controller/SearchController.php
deleted file mode 100644
index 166e2bad53b..00000000000
--- a/core/Controller/SearchController.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-/**
- * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-namespace OC\Core\Controller;
-
-use OCP\AppFramework\Controller;
-use OCP\AppFramework\Http\Attribute\FrontpageRoute;
-use OCP\AppFramework\Http\Attribute\NoAdminRequired;
-use OCP\AppFramework\Http\JSONResponse;
-use OCP\IRequest;
-use OCP\ISearch;
-use OCP\Search\Result;
-use Psr\Log\LoggerInterface;
-
-class SearchController extends Controller {
- public function __construct(
- string $appName,
- IRequest $request,
- private ISearch $searcher,
- private LoggerInterface $logger,
- ) {
- parent::__construct($appName, $request);
- }
-
- #[NoAdminRequired]
- #[FrontpageRoute(verb: 'GET', url: '/core/search')]
- public function search(string $query, array $inApps = [], int $page = 1, int $size = 30): JSONResponse {
- $results = $this->searcher->searchPaged($query, $inApps, $page, $size);
-
- $results = array_filter($results, function (Result $result) {
- if (json_encode($result, JSON_HEX_TAG) === false) {
- $this->logger->warning("Skipping search result due to invalid encoding: {type: " . $result->type . ", id: " . $result->id . "}");
- return false;
- } else {
- return true;
- }
- });
-
- return new JSONResponse($results);
- }
-}
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index f605e076094..d5a3dcb5cd5 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -537,7 +537,6 @@ return array(
'OCP\\IPreview' => $baseDir . '/lib/public/IPreview.php',
'OCP\\IRequest' => $baseDir . '/lib/public/IRequest.php',
'OCP\\IRequestId' => $baseDir . '/lib/public/IRequestId.php',
- 'OCP\\ISearch' => $baseDir . '/lib/public/ISearch.php',
'OCP\\IServerContainer' => $baseDir . '/lib/public/IServerContainer.php',
'OCP\\ISession' => $baseDir . '/lib/public/ISession.php',
'OCP\\IStreamImage' => $baseDir . '/lib/public/IStreamImage.php',
@@ -1265,7 +1264,6 @@ return array(
'OC\\Core\\Controller\\RecommendedAppsController' => $baseDir . '/core/Controller/RecommendedAppsController.php',
'OC\\Core\\Controller\\ReferenceApiController' => $baseDir . '/core/Controller/ReferenceApiController.php',
'OC\\Core\\Controller\\ReferenceController' => $baseDir . '/core/Controller/ReferenceController.php',
- 'OC\\Core\\Controller\\SearchController' => $baseDir . '/core/Controller/SearchController.php',
'OC\\Core\\Controller\\SetupController' => $baseDir . '/core/Controller/SetupController.php',
'OC\\Core\\Controller\\TaskProcessingApiController' => $baseDir . '/core/Controller/TaskProcessingApiController.php',
'OC\\Core\\Controller\\TeamsApiController' => $baseDir . '/core/Controller/TeamsApiController.php',
@@ -1813,7 +1811,6 @@ return array(
'OC\\Route\\CachingRouter' => $baseDir . '/lib/private/Route/CachingRouter.php',
'OC\\Route\\Route' => $baseDir . '/lib/private/Route/Route.php',
'OC\\Route\\Router' => $baseDir . '/lib/private/Route/Router.php',
- 'OC\\Search' => $baseDir . '/lib/private/Search.php',
'OC\\Search\\FilterCollection' => $baseDir . '/lib/private/Search/FilterCollection.php',
'OC\\Search\\FilterFactory' => $baseDir . '/lib/private/Search/FilterFactory.php',
'OC\\Search\\Filter\\BooleanFilter' => $baseDir . '/lib/private/Search/Filter/BooleanFilter.php',
@@ -1824,11 +1821,6 @@ return array(
'OC\\Search\\Filter\\StringFilter' => $baseDir . '/lib/private/Search/Filter/StringFilter.php',
'OC\\Search\\Filter\\StringsFilter' => $baseDir . '/lib/private/Search/Filter/StringsFilter.php',
'OC\\Search\\Filter\\UserFilter' => $baseDir . '/lib/private/Search/Filter/UserFilter.php',
- 'OC\\Search\\Provider\\File' => $baseDir . '/lib/private/Search/Provider/File.php',
- 'OC\\Search\\Result\\Audio' => $baseDir . '/lib/private/Search/Result/Audio.php',
- 'OC\\Search\\Result\\File' => $baseDir . '/lib/private/Search/Result/File.php',
- 'OC\\Search\\Result\\Folder' => $baseDir . '/lib/private/Search/Result/Folder.php',
- 'OC\\Search\\Result\\Image' => $baseDir . '/lib/private/Search/Result/Image.php',
'OC\\Search\\SearchComposer' => $baseDir . '/lib/private/Search/SearchComposer.php',
'OC\\Search\\SearchQuery' => $baseDir . '/lib/private/Search/SearchQuery.php',
'OC\\Search\\UnsupportedFilter' => $baseDir . '/lib/private/Search/UnsupportedFilter.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index 3be8b2cf648..e148567b4c9 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -570,7 +570,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OCP\\IPreview' => __DIR__ . '/../../..' . '/lib/public/IPreview.php',
'OCP\\IRequest' => __DIR__ . '/../../..' . '/lib/public/IRequest.php',
'OCP\\IRequestId' => __DIR__ . '/../../..' . '/lib/public/IRequestId.php',
- 'OCP\\ISearch' => __DIR__ . '/../../..' . '/lib/public/ISearch.php',
'OCP\\IServerContainer' => __DIR__ . '/../../..' . '/lib/public/IServerContainer.php',
'OCP\\ISession' => __DIR__ . '/../../..' . '/lib/public/ISession.php',
'OCP\\IStreamImage' => __DIR__ . '/../../..' . '/lib/public/IStreamImage.php',
@@ -1298,7 +1297,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OC\\Core\\Controller\\RecommendedAppsController' => __DIR__ . '/../../..' . '/core/Controller/RecommendedAppsController.php',
'OC\\Core\\Controller\\ReferenceApiController' => __DIR__ . '/../../..' . '/core/Controller/ReferenceApiController.php',
'OC\\Core\\Controller\\ReferenceController' => __DIR__ . '/../../..' . '/core/Controller/ReferenceController.php',
- 'OC\\Core\\Controller\\SearchController' => __DIR__ . '/../../..' . '/core/Controller/SearchController.php',
'OC\\Core\\Controller\\SetupController' => __DIR__ . '/../../..' . '/core/Controller/SetupController.php',
'OC\\Core\\Controller\\TaskProcessingApiController' => __DIR__ . '/../../..' . '/core/Controller/TaskProcessingApiController.php',
'OC\\Core\\Controller\\TeamsApiController' => __DIR__ . '/../../..' . '/core/Controller/TeamsApiController.php',
@@ -1846,7 +1844,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OC\\Route\\CachingRouter' => __DIR__ . '/../../..' . '/lib/private/Route/CachingRouter.php',
'OC\\Route\\Route' => __DIR__ . '/../../..' . '/lib/private/Route/Route.php',
'OC\\Route\\Router' => __DIR__ . '/../../..' . '/lib/private/Route/Router.php',
- 'OC\\Search' => __DIR__ . '/../../..' . '/lib/private/Search.php',
'OC\\Search\\FilterCollection' => __DIR__ . '/../../..' . '/lib/private/Search/FilterCollection.php',
'OC\\Search\\FilterFactory' => __DIR__ . '/../../..' . '/lib/private/Search/FilterFactory.php',
'OC\\Search\\Filter\\BooleanFilter' => __DIR__ . '/../../..' . '/lib/private/Search/Filter/BooleanFilter.php',
@@ -1857,11 +1854,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OC\\Search\\Filter\\StringFilter' => __DIR__ . '/../../..' . '/lib/private/Search/Filter/StringFilter.php',
'OC\\Search\\Filter\\StringsFilter' => __DIR__ . '/../../..' . '/lib/private/Search/Filter/StringsFilter.php',
'OC\\Search\\Filter\\UserFilter' => __DIR__ . '/../../..' . '/lib/private/Search/Filter/UserFilter.php',
- 'OC\\Search\\Provider\\File' => __DIR__ . '/../../..' . '/lib/private/Search/Provider/File.php',
- 'OC\\Search\\Result\\Audio' => __DIR__ . '/../../..' . '/lib/private/Search/Result/Audio.php',
- 'OC\\Search\\Result\\File' => __DIR__ . '/../../..' . '/lib/private/Search/Result/File.php',
- 'OC\\Search\\Result\\Folder' => __DIR__ . '/../../..' . '/lib/private/Search/Result/Folder.php',
- 'OC\\Search\\Result\\Image' => __DIR__ . '/../../..' . '/lib/private/Search/Result/Image.php',
'OC\\Search\\SearchComposer' => __DIR__ . '/../../..' . '/lib/private/Search/SearchComposer.php',
'OC\\Search\\SearchQuery' => __DIR__ . '/../../..' . '/lib/private/Search/SearchQuery.php',
'OC\\Search\\UnsupportedFilter' => __DIR__ . '/../../..' . '/lib/private/Search/UnsupportedFilter.php',
diff --git a/lib/private/Search.php b/lib/private/Search.php
deleted file mode 100644
index d51a305b331..00000000000
--- a/lib/private/Search.php
+++ /dev/null
@@ -1,100 +0,0 @@
-<?php
-
-/**
- * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
- * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
- * SPDX-License-Identifier: AGPL-3.0-only
- */
-namespace OC;
-
-use OCP\ISearch;
-use OCP\Search\PagedProvider;
-use OCP\Search\Provider;
-use Psr\Log\LoggerInterface;
-
-/**
- * Provide an interface to all search providers
- */
-class Search implements ISearch {
- /** @var Provider[] */
- private $providers = [];
- private $registeredProviders = [];
-
- /**
- * Search all providers for $query
- * @param string $query
- * @param string[] $inApps optionally limit results to the given apps
- * @param int $page pages start at page 1
- * @param int $size, 0 = all
- * @return array An array of OC\Search\Result's
- */
- public function searchPaged($query, array $inApps = [], $page = 1, $size = 30) {
- $this->initProviders();
- $results = [];
- foreach ($this->providers as $provider) {
- if (! $provider->providesResultsFor($inApps)) {
- continue;
- }
- if ($provider instanceof PagedProvider) {
- $results = array_merge($results, $provider->searchPaged($query, $page, $size));
- } elseif ($provider instanceof Provider) {
- $providerResults = $provider->search($query);
- if ($size > 0) {
- $slicedResults = array_slice($providerResults, ($page - 1) * $size, $size);
- $results = array_merge($results, $slicedResults);
- } else {
- $results = array_merge($results, $providerResults);
- }
- } else {
- \OCP\Server::get(LoggerInterface::class)->warning('Ignoring Unknown search provider', ['provider' => $provider]);
- }
- }
- return $results;
- }
-
- /**
- * Remove all registered search providers
- */
- public function clearProviders() {
- $this->providers = [];
- $this->registeredProviders = [];
- }
-
- /**
- * Remove one existing search provider
- * @param string $provider class name of a OC\Search\Provider
- */
- public function removeProvider($provider) {
- $this->registeredProviders = array_filter(
- $this->registeredProviders,
- function ($element) use ($provider) {
- return ($element['class'] != $provider);
- }
- );
- // force regeneration of providers on next search
- $this->providers = [];
- }
-
- /**
- * Register a new search provider to search with
- * @param string $class class name of a OC\Search\Provider
- * @param array $options optional
- */
- public function registerProvider($class, array $options = []) {
- $this->registeredProviders[] = ['class' => $class, 'options' => $options];
- }
-
- /**
- * Create instances of all the registered search providers
- */
- private function initProviders() {
- if (! empty($this->providers)) {
- return;
- }
- foreach ($this->registeredProviders as $provider) {
- $class = $provider['class'];
- $options = $provider['options'];
- $this->providers[] = new $class($options);
- }
- }
-}
diff --git a/lib/private/Search/Provider/File.php b/lib/private/Search/Provider/File.php
deleted file mode 100644
index ca4b1b8677f..00000000000
--- a/lib/private/Search/Provider/File.php
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-
-/**
- * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
- * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
- * SPDX-License-Identifier: AGPL-3.0-only
- */
-namespace OC\Search\Provider;
-
-use OC\Files\Search\SearchComparison;
-use OC\Files\Search\SearchOrder;
-use OC\Files\Search\SearchQuery;
-use OCP\Files\FileInfo;
-use OCP\Files\IRootFolder;
-use OCP\Files\Search\ISearchComparison;
-use OCP\Files\Search\ISearchOrder;
-use OCP\IUserSession;
-use OCP\Search\PagedProvider;
-
-/**
- * Provide search results from the 'files' app
- * @deprecated 20.0.0
- */
-class File extends PagedProvider {
- /**
- * Search for files and folders matching the given query
- *
- * @param string $query
- * @param int|null $limit
- * @param int|null $offset
- * @return \OCP\Search\Result[]
- * @deprecated 20.0.0
- */
- public function search($query, ?int $limit = null, ?int $offset = null) {
- /** @var IRootFolder $rootFolder */
- $rootFolder = \OCP\Server::get(IRootFolder::class);
- /** @var IUserSession $userSession */
- $userSession = \OCP\Server::get(IUserSession::class);
- $user = $userSession->getUser();
- if (!$user) {
- return [];
- }
- $userFolder = $rootFolder->getUserFolder($user->getUID());
- $fileQuery = new SearchQuery(
- new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%' . $query . '%'),
- (int)$limit,
- (int)$offset,
- [
- new SearchOrder(ISearchOrder::DIRECTION_DESCENDING, 'mtime'),
- ],
- $user
- );
- $files = $userFolder->search($fileQuery);
- $results = [];
- // edit results
- foreach ($files as $fileData) {
- // create audio result
- if ($fileData->getMimePart() === 'audio') {
- $result = new \OC\Search\Result\Audio($fileData);
- }
- // create image result
- elseif ($fileData->getMimePart() === 'image') {
- $result = new \OC\Search\Result\Image($fileData);
- }
- // create folder result
- elseif ($fileData->getMimetype() === FileInfo::MIMETYPE_FOLDER) {
- $result = new \OC\Search\Result\Folder($fileData);
- }
- // or create file result
- else {
- $result = new \OC\Search\Result\File($fileData);
- }
- // add to results
- $results[] = $result;
- }
- // return
- return $results;
- }
-
- public function searchPaged($query, $page, $size) {
- if ($size === 0) {
- return $this->search($query);
- } else {
- return $this->search($query, $size, ($page - 1) * $size);
- }
- }
-}
diff --git a/lib/private/Search/Result/Audio.php b/lib/private/Search/Result/Audio.php
deleted file mode 100644
index 42b8ac75da0..00000000000
--- a/lib/private/Search/Result/Audio.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-/**
- * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
- * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
- * SPDX-License-Identifier: AGPL-3.0-only
- */
-namespace OC\Search\Result;
-
-/**
- * A found audio file
- * @deprecated 20.0.0
- */
-class Audio extends File {
- /**
- * Type name; translated in templates
- * @var string
- * @deprecated 20.0.0
- */
- public $type = 'audio';
-
- /**
- * @TODO add ID3 information
- */
-}
diff --git a/lib/private/Search/Result/File.php b/lib/private/Search/Result/File.php
deleted file mode 100644
index f1346481b86..00000000000
--- a/lib/private/Search/Result/File.php
+++ /dev/null
@@ -1,132 +0,0 @@
-<?php
-
-/**
- * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
- * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
- * SPDX-License-Identifier: AGPL-3.0-only
- */
-namespace OC\Search\Result;
-
-use OCP\Files\FileInfo;
-use OCP\Files\Folder;
-use OCP\IPreview;
-use OCP\IUserSession;
-
-/**
- * A found file
- * @deprecated 20.0.0
- */
-class File extends \OCP\Search\Result {
- /**
- * Type name; translated in templates
- * @var string
- * @deprecated 20.0.0
- */
- public $type = 'file';
-
- /**
- * Path to file
- * @var string
- * @deprecated 20.0.0
- */
- public $path;
-
- /**
- * Size, in bytes
- * @var int
- * @deprecated 20.0.0
- */
- public $size;
-
- /**
- * Date modified, in human readable form
- * @var string
- * @deprecated 20.0.0
- */
- public $modified;
-
- /**
- * File mime type
- * @var string
- * @deprecated 20.0.0
- */
- public $mime_type;
-
- /**
- * File permissions:
- *
- * @var string
- * @deprecated 20.0.0
- */
- public $permissions;
-
- /**
- * Has a preview
- *
- * @var string
- * @deprecated 20.0.0
- */
- public $has_preview;
-
- /**
- * Create a new file search result
- * @param FileInfo $data file data given by provider
- * @deprecated 20.0.0
- */
- public function __construct(FileInfo $data) {
- $path = $this->getRelativePath($data->getPath());
-
- $this->id = $data->getId();
- $this->name = $data->getName();
- $this->link = \OC::$server->getURLGenerator()->linkToRoute(
- 'files.view.index',
- [
- 'dir' => dirname($path),
- 'scrollto' => $data->getName(),
- ]
- );
- $this->permissions = $data->getPermissions();
- $this->path = $path;
- $this->size = $data->getSize();
- $this->modified = $data->getMtime();
- $this->mime_type = $data->getMimetype();
- $this->has_preview = $this->hasPreview($data);
- }
-
- /**
- * @var Folder $userFolderCache
- * @deprecated 20.0.0
- */
- protected static $userFolderCache = null;
-
- /**
- * converts a path relative to the users files folder
- * eg /user/files/foo.txt -> /foo.txt
- * @param string $path
- * @return string relative path
- * @deprecated 20.0.0
- */
- protected function getRelativePath($path) {
- if (!isset(self::$userFolderCache)) {
- $userSession = \OC::$server->get(IUserSession::class);
- $userID = $userSession->getUser()->getUID();
- self::$userFolderCache = \OC::$server->getUserFolder($userID);
- }
- $relativePath = self::$userFolderCache->getRelativePath($path);
- if ($relativePath === null) {
- throw new \Exception("Search result not in user folder");
- }
- return $relativePath;
- }
-
- /**
- * Is the preview available
- * @param FileInfo $data
- * @return bool
- * @deprecated 20.0.0
- */
- protected function hasPreview($data) {
- $previewManager = \OC::$server->get(IPreview::class);
- return $previewManager->isAvailable($data);
- }
-}
diff --git a/lib/private/Search/Result/Folder.php b/lib/private/Search/Result/Folder.php
deleted file mode 100644
index 37de0a031a7..00000000000
--- a/lib/private/Search/Result/Folder.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-/**
- * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
- * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
- * SPDX-License-Identifier: AGPL-3.0-only
- */
-namespace OC\Search\Result;
-
-/**
- * A found folder
- * @deprecated 20.0.0
- */
-class Folder extends File {
- /**
- * Type name; translated in templates
- * @var string
- * @deprecated 20.0.0
- */
- public $type = 'folder';
-}
diff --git a/lib/private/Search/Result/Image.php b/lib/private/Search/Result/Image.php
deleted file mode 100644
index e1333424017..00000000000
--- a/lib/private/Search/Result/Image.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-/**
- * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
- * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
- * SPDX-License-Identifier: AGPL-3.0-only
- */
-namespace OC\Search\Result;
-
-/**
- * A found image file
- * @deprecated 20.0.0
- */
-class Image extends File {
- /**
- * Type name; translated in templates
- * @var string
- * @deprecated 20.0.0
- */
- public $type = 'image';
-
- /**
- * @TODO add EXIF information
- */
-}
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 3d156454920..e88f44fc066 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -185,7 +185,6 @@ use OCP\IPhoneNumberUtil;
use OCP\IPreview;
use OCP\IRequest;
use OCP\IRequestId;
-use OCP\ISearch;
use OCP\IServerContainer;
use OCP\ISession;
use OCP\ITagManager;
@@ -765,10 +764,6 @@ class Server extends ServerContainer implements IServerContainer {
/** @deprecated 19.0.0 */
$this->registerDeprecatedAlias('Router', IRouter::class);
- $this->registerAlias(ISearch::class, Search::class);
- /** @deprecated 19.0.0 */
- $this->registerDeprecatedAlias('Search', ISearch::class);
-
$this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) {
$config = $c->get(\OCP\IConfig::class);
if (ltrim($config->getSystemValueString('memcache.distributed', ''), '\\') === \OC\Memcache\Redis::class) {
@@ -1810,16 +1805,6 @@ class Server extends ServerContainer implements IServerContainer {
}
/**
- * Returns a search instance
- *
- * @return ISearch
- * @deprecated 20.0.0
- */
- public function getSearch() {
- return $this->get(ISearch::class);
- }
-
- /**
* Returns a SecureRandom instance
*
* @return \OCP\Security\ISecureRandom
diff --git a/lib/public/ISearch.php b/lib/public/ISearch.php
deleted file mode 100644
index 4279ee580c5..00000000000
--- a/lib/public/ISearch.php
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-
-/**
- * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
- * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
- * SPDX-License-Identifier: AGPL-3.0-only
- */
-namespace OCP;
-
-/**
- * Small Interface for Search
- * @since 7.0.0
- * @deprecated 20.0.0
- */
-interface ISearch {
- /**
- * Search all providers for $query
- * @param string $query
- * @param string[] $inApps optionally limit results to the given apps
- * @param int $page pages start at page 1
- * @param int $size
- * @return array An array of OCP\Search\Result's
- * @since 8.0.0
- * @deprecated 20.0.0
- */
- public function searchPaged($query, array $inApps = [], $page = 1, $size = 30);
-
- /**
- * Register a new search provider to search with
- * @param string $class class name of a OCP\Search\Provider
- * @param array $options optional
- * @since 7.0.0
- * @deprecated 20.0.0
- */
- public function registerProvider($class, array $options = []);
-
- /**
- * Remove one existing search provider
- * @param string $provider class name of a OCP\Search\Provider
- * @since 7.0.0
- * @deprecated 20.0.0
- */
- public function removeProvider($provider);
-
- /**
- * Remove all registered search providers
- * @since 7.0.0
- * @deprecated 20.0.0
- */
- public function clearProviders();
-}
diff --git a/lib/public/IServerContainer.php b/lib/public/IServerContainer.php
index 74e7153f810..027dfcb77c4 100644
--- a/lib/public/IServerContainer.php
+++ b/lib/public/IServerContainer.php
@@ -344,15 +344,6 @@ interface IServerContainer extends ContainerInterface, IContainer {
public function getRouter();
/**
- * Returns a search instance
- *
- * @return \OCP\ISearch
- * @since 7.0.0
- * @deprecated 20.0.0
- */
- public function getSearch();
-
- /**
* Get the certificate manager
*
* @return \OCP\ICertificateManager
diff --git a/tests/lib/ServerTest.php b/tests/lib/ServerTest.php
index d9ff8ea41c2..e43c10b9cde 100644
--- a/tests/lib/ServerTest.php
+++ b/tests/lib/ServerTest.php
@@ -119,8 +119,6 @@ class ServerTest extends \Test\TestCase {
['RootFolder', '\OCP\Files\Folder'],
['Router', '\OCP\Route\IRouter'],
- ['Search', '\OC\Search'],
- ['Search', '\OCP\ISearch'],
['SecureRandom', '\OC\Security\SecureRandom'],
['SecureRandom', '\OCP\Security\ISecureRandom'],
['ShareManager', '\OC\Share20\Manager'],