Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactors lib/private/FullTextSearch #38996

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@
'OCP\\Files\\UnseekableException' => $baseDir . '/lib/public/Files/UnseekableException.php',
'OCP\\Files_FullTextSearch\\Model\\AFilesDocument' => $baseDir . '/lib/public/Files_FullTextSearch/Model/AFilesDocument.php',
'OCP\\FullTextSearch\\Exceptions\\FullTextSearchAppNotAvailableException' => $baseDir . '/lib/public/FullTextSearch/Exceptions/FullTextSearchAppNotAvailableException.php',
'OCP\\FullTextSearch\\Exceptions\\FullTextSearchIndexNotAvailableException' => $baseDir . '/lib/public/FullTextSearch/Exceptions/FullTextSearchIndexNotAvailableException.php',
fsamapoor marked this conversation as resolved.
Show resolved Hide resolved
'OCP\\FullTextSearch\\IFullTextSearchManager' => $baseDir . '/lib/public/FullTextSearch/IFullTextSearchManager.php',
'OCP\\FullTextSearch\\IFullTextSearchPlatform' => $baseDir . '/lib/public/FullTextSearch/IFullTextSearchPlatform.php',
'OCP\\FullTextSearch\\IFullTextSearchProvider' => $baseDir . '/lib/public/FullTextSearch/IFullTextSearchProvider.php',
Expand Down
1 change: 1 addition & 0 deletions lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OCP\\Files\\UnseekableException' => __DIR__ . '/../../..' . '/lib/public/Files/UnseekableException.php',
'OCP\\Files_FullTextSearch\\Model\\AFilesDocument' => __DIR__ . '/../../..' . '/lib/public/Files_FullTextSearch/Model/AFilesDocument.php',
'OCP\\FullTextSearch\\Exceptions\\FullTextSearchAppNotAvailableException' => __DIR__ . '/../../..' . '/lib/public/FullTextSearch/Exceptions/FullTextSearchAppNotAvailableException.php',
'OCP\\FullTextSearch\\Exceptions\\FullTextSearchIndexNotAvailableException' => __DIR__ . '/../../..' . '/lib/public/FullTextSearch/Exceptions/FullTextSearchIndexNotAvailableException.php',
'OCP\\FullTextSearch\\IFullTextSearchManager' => __DIR__ . '/../../..' . '/lib/public/FullTextSearch/IFullTextSearchManager.php',
'OCP\\FullTextSearch\\IFullTextSearchPlatform' => __DIR__ . '/../../..' . '/lib/public/FullTextSearch/IFullTextSearchPlatform.php',
'OCP\\FullTextSearch\\IFullTextSearchProvider' => __DIR__ . '/../../..' . '/lib/public/FullTextSearch/IFullTextSearchProvider.php',
Expand Down
77 changes: 26 additions & 51 deletions lib/private/FullTextSearch/FullTextSearchManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,47 +39,35 @@
* @package OC\FullTextSearch
*/
class FullTextSearchManager implements IFullTextSearchManager {
/** @var IProviderService */
private $providerService;
private ?IProviderService $providerService;

/** @var IIndexService */
private $indexService;

/** @var ISearchService */
private $searchService;
private ?IIndexService $indexService;

private ?ISearchService $searchService;

/**
* @since 15.0.0
*
* @param IProviderService $providerService
*/
public function registerProviderService(IProviderService $providerService) {
public function registerProviderService(IProviderService $providerService): void {
$this->providerService = $providerService;
}

/**
* @since 15.0.0
*
* @param IIndexService $indexService
*/
public function registerIndexService(IIndexService $indexService) {
public function registerIndexService(IIndexService $indexService): void {
$this->indexService = $indexService;
}

/**
* @since 15.0.0
*
* @param ISearchService $searchService
*/
public function registerSearchService(ISearchService $searchService) {
public function registerSearchService(ISearchService $searchService): void {
$this->searchService = $searchService;
}

/**
* @since 16.0.0
*
* @return bool
*/
public function isAvailable(): bool {
if ($this->indexService === null ||
Expand All @@ -93,7 +81,6 @@ public function isAvailable(): bool {


/**
* @return IProviderService
* @throws FullTextSearchAppNotAvailableException
*/
private function getProviderService(): IProviderService {
Expand All @@ -106,7 +93,6 @@ private function getProviderService(): IProviderService {


/**
* @return IIndexService
* @throws FullTextSearchAppNotAvailableException
*/
private function getIndexService(): IIndexService {
Expand All @@ -119,7 +105,6 @@ private function getIndexService(): IIndexService {


/**
* @return ISearchService
* @throws FullTextSearchAppNotAvailableException
*/
private function getSearchService(): ISearchService {
Expand All @@ -134,15 +119,12 @@ private function getSearchService(): ISearchService {
/**
* @throws FullTextSearchAppNotAvailableException
*/
public function addJavascriptAPI() {
public function addJavascriptAPI(): void {
$this->getProviderService()->addJavascriptAPI();
}


/**
* @param string $providerId
*
* @return bool
* @throws FullTextSearchAppNotAvailableException
*/
public function isProviderIndexed(string $providerId): bool {
Expand All @@ -151,56 +133,52 @@ public function isProviderIndexed(string $providerId): bool {


/**
* @param string $providerId
* @param string $documentId
* @return IIndex
* @throws FullTextSearchAppNotAvailableException
*/
public function getIndex(string $providerId, string $documentId): IIndex {
return $this->getIndexService()->getIndex($providerId, $documentId);
}

/**
* @param string $providerId
* @param string $documentId
* @param string $userId
* @param int $status
*
* @see IIndex for available value for $status.
*
* @return IIndex
* @throws FullTextSearchAppNotAvailableException
*/
public function createIndex(string $providerId, string $documentId, string $userId, int $status = 0): IIndex {
public function createIndex(
string $providerId,
string $documentId,
string $userId,
int $status = 0,
): IIndex {
return $this->getIndexService()->createIndex($providerId, $documentId, $userId, $status);
}


/**
* @param string $providerId
* @param string $documentId
* @param int $status
* @param bool $reset
*
* @see IIndex for available value for $status.
*
* @throws FullTextSearchAppNotAvailableException
*/
public function updateIndexStatus(string $providerId, string $documentId, int $status, bool $reset = false) {
public function updateIndexStatus(
string $providerId,
string $documentId,
int $status,
bool $reset = false,
): void {
$this->getIndexService()->updateIndexStatus($providerId, $documentId, $status, $reset);
}

/**
* @param string $providerId
* @param array $documentIds
* @param int $status
* @param bool $reset
*
* @see IIndex for available value for $status.
*
* @throws FullTextSearchAppNotAvailableException
*/
public function updateIndexesStatus(string $providerId, array $documentIds, int $status, bool $reset = false) {
public function updateIndexesStatus(
string $providerId,
array $documentIds,
int $status,
bool $reset = false,
): void {
$this->getIndexService()->updateIndexesStatus($providerId, $documentIds, $status, $reset);
}

Expand All @@ -210,15 +188,12 @@ public function updateIndexesStatus(string $providerId, array $documentIds, int
*
* @throws FullTextSearchAppNotAvailableException
*/
public function updateIndexes(array $indexes) {
public function updateIndexes(array $indexes): void {
$this->getIndexService()->updateIndexes($indexes);
}


/**
* @param array $request
* @param string $userId
*
* @return ISearchResult[]
* @throws FullTextSearchAppNotAvailableException
*/
Expand Down
Loading
Loading