mirror of https://github.com/nextcloud/server
Merge pull request #38996 from fsamapoor/refactor_lib_private_fulltextsearch
This commit is contained in:
commit
1629b4103d
|
@ -429,6 +429,7 @@ return array(
|
|||
'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',
|
||||
'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',
|
||||
|
|
|
@ -462,6 +462,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',
|
||||
|
|
|
@ -39,47 +39,35 @@ use OCP\FullTextSearch\Service\ISearchService;
|
|||
* @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 ||
|
||||
|
@ -93,7 +81,6 @@ class FullTextSearchManager implements IFullTextSearchManager {
|
|||
|
||||
|
||||
/**
|
||||
* @return IProviderService
|
||||
* @throws FullTextSearchAppNotAvailableException
|
||||
*/
|
||||
private function getProviderService(): IProviderService {
|
||||
|
@ -106,7 +93,6 @@ class FullTextSearchManager implements IFullTextSearchManager {
|
|||
|
||||
|
||||
/**
|
||||
* @return IIndexService
|
||||
* @throws FullTextSearchAppNotAvailableException
|
||||
*/
|
||||
private function getIndexService(): IIndexService {
|
||||
|
@ -119,7 +105,6 @@ class FullTextSearchManager implements IFullTextSearchManager {
|
|||
|
||||
|
||||
/**
|
||||
* @return ISearchService
|
||||
* @throws FullTextSearchAppNotAvailableException
|
||||
*/
|
||||
private function getSearchService(): ISearchService {
|
||||
|
@ -134,15 +119,12 @@ class FullTextSearchManager implements IFullTextSearchManager {
|
|||
/**
|
||||
* @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 {
|
||||
|
@ -151,9 +133,6 @@ class FullTextSearchManager implements IFullTextSearchManager {
|
|||
|
||||
|
||||
/**
|
||||
* @param string $providerId
|
||||
* @param string $documentId
|
||||
* @return IIndex
|
||||
* @throws FullTextSearchAppNotAvailableException
|
||||
*/
|
||||
public function getIndex(string $providerId, string $documentId): IIndex {
|
||||
|
@ -161,46 +140,45 @@ class FullTextSearchManager implements IFullTextSearchManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
|
||||
|
@ -210,15 +188,12 @@ class FullTextSearchManager implements IFullTextSearchManager {
|
|||
*
|
||||
* @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
|
||||
*/
|
||||
|
|
|
@ -49,23 +49,17 @@ use OCP\FullTextSearch\Model\IDocumentAccess;
|
|||
* @package OC\FullTextSearch\Model
|
||||
*/
|
||||
final class DocumentAccess implements IDocumentAccess, JsonSerializable {
|
||||
/** @var string */
|
||||
private $ownerId;
|
||||
private string $ownerId;
|
||||
|
||||
/** @var string */
|
||||
private $viewerId = '';
|
||||
private string $viewerId = '';
|
||||
|
||||
/** @var array */
|
||||
private $users = [];
|
||||
private array $users = [];
|
||||
|
||||
/** @var array */
|
||||
private $groups = [];
|
||||
private array $groups = [];
|
||||
|
||||
/** @var array */
|
||||
private $circles = [];
|
||||
private array $circles = [];
|
||||
|
||||
/** @var array */
|
||||
private $links = [];
|
||||
private array $links = [];
|
||||
|
||||
|
||||
/**
|
||||
|
@ -74,8 +68,6 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable {
|
|||
* @since 16.0.0
|
||||
*
|
||||
* IDocumentAccess constructor.
|
||||
*
|
||||
* @param string $ownerId
|
||||
*/
|
||||
public function __construct(string $ownerId = '') {
|
||||
$this->setOwnerId($ownerId);
|
||||
|
@ -86,10 +78,6 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable {
|
|||
* Set the Owner of the document.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @param string $ownerId
|
||||
*
|
||||
* @return IDocumentAccess
|
||||
*/
|
||||
public function setOwnerId(string $ownerId): IDocumentAccess {
|
||||
$this->ownerId = $ownerId;
|
||||
|
@ -101,8 +89,6 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable {
|
|||
* Get the Owner of the document.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOwnerId(): string {
|
||||
return $this->ownerId;
|
||||
|
@ -113,10 +99,6 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable {
|
|||
* Set the viewer of the document.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @param string $viewerId
|
||||
*
|
||||
* @return IDocumentAccess
|
||||
*/
|
||||
public function setViewerId(string $viewerId): IDocumentAccess {
|
||||
$this->viewerId = $viewerId;
|
||||
|
@ -128,8 +110,6 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable {
|
|||
* Get the viewer of the document.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getViewerId(): string {
|
||||
return $this->viewerId;
|
||||
|
@ -140,10 +120,6 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable {
|
|||
* Set the list of users that have read access to the document.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @param array $users
|
||||
*
|
||||
* @return IDocumentAccess
|
||||
*/
|
||||
public function setUsers(array $users): IDocumentAccess {
|
||||
$this->users = $users;
|
||||
|
@ -155,10 +131,6 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable {
|
|||
* Add an entry to the list of users that have read access to the document.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return IDocumentAccess
|
||||
*/
|
||||
public function addUser(string $user): IDocumentAccess {
|
||||
$this->users[] = $user;
|
||||
|
@ -171,10 +143,6 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable {
|
|||
* document.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @param array $users
|
||||
*
|
||||
* @return IDocumentAccess
|
||||
*/
|
||||
public function addUsers($users): IDocumentAccess {
|
||||
$this->users = array_merge($this->users, $users);
|
||||
|
@ -186,8 +154,6 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable {
|
|||
* Get the complete list of users that have read access to the document.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getUsers(): array {
|
||||
return $this->users;
|
||||
|
@ -198,10 +164,6 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable {
|
|||
* Set the list of groups that have read access to the document.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @param array $groups
|
||||
*
|
||||
* @return IDocumentAccess
|
||||
*/
|
||||
public function setGroups(array $groups): IDocumentAccess {
|
||||
$this->groups = $groups;
|
||||
|
@ -213,10 +175,6 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable {
|
|||
* Add an entry to the list of groups that have read access to the document.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @param string $group
|
||||
*
|
||||
* @return IDocumentAccess
|
||||
*/
|
||||
public function addGroup(string $group): IDocumentAccess {
|
||||
$this->groups[] = $group;
|
||||
|
@ -229,12 +187,8 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable {
|
|||
* document.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @param array $groups
|
||||
*
|
||||
* @return IDocumentAccess
|
||||
*/
|
||||
public function addGroups(array $groups) {
|
||||
public function addGroups(array $groups): IDocumentAccess {
|
||||
$this->groups = array_merge($this->groups, $groups);
|
||||
|
||||
return $this;
|
||||
|
@ -244,8 +198,6 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable {
|
|||
* Get the complete list of groups that have read access to the document.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getGroups(): array {
|
||||
return $this->groups;
|
||||
|
@ -256,10 +208,6 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable {
|
|||
* Set the list of circles that have read access to the document.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @param array $circles
|
||||
*
|
||||
* @return IDocumentAccess
|
||||
*/
|
||||
public function setCircles(array $circles): IDocumentAccess {
|
||||
$this->circles = $circles;
|
||||
|
@ -271,10 +219,6 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable {
|
|||
* Add an entry to the list of circles that have read access to the document.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @param string $circle
|
||||
*
|
||||
* @return IDocumentAccess
|
||||
*/
|
||||
public function addCircle(string $circle): IDocumentAccess {
|
||||
$this->circles[] = $circle;
|
||||
|
@ -287,10 +231,6 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable {
|
|||
* document.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @param array $circles
|
||||
*
|
||||
* @return IDocumentAccess
|
||||
*/
|
||||
public function addCircles(array $circles): IDocumentAccess {
|
||||
$this->circles = array_merge($this->circles, $circles);
|
||||
|
@ -302,8 +242,6 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable {
|
|||
* Get the complete list of circles that have read access to the document.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCircles(): array {
|
||||
return $this->circles;
|
||||
|
@ -314,10 +252,6 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable {
|
|||
* Set the list of links that have read access to the document.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @param array $links
|
||||
*
|
||||
* @return IDocumentAccess
|
||||
*/
|
||||
public function setLinks(array $links): IDocumentAccess {
|
||||
$this->links = $links;
|
||||
|
@ -329,8 +263,6 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable {
|
|||
* Get the list of links that have read access to the document.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getLinks(): array {
|
||||
return $this->links;
|
||||
|
@ -339,8 +271,6 @@ final class DocumentAccess implements IDocumentAccess, JsonSerializable {
|
|||
|
||||
/**
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize(): array {
|
||||
return [
|
||||
|
|
|
@ -26,6 +26,7 @@ declare(strict_types=1);
|
|||
namespace OC\FullTextSearch\Model;
|
||||
|
||||
use JsonSerializable;
|
||||
use OCP\FullTextSearch\Exceptions\FullTextSearchIndexNotAvailableException;
|
||||
use OCP\FullTextSearch\Model\IDocumentAccess;
|
||||
use OCP\FullTextSearch\Model\IIndex;
|
||||
use OCP\FullTextSearch\Model\IIndexDocument;
|
||||
|
@ -47,62 +48,41 @@ use OCP\FullTextSearch\Model\IIndexDocument;
|
|||
* @package OC\FullTextSearch\Model
|
||||
*/
|
||||
class IndexDocument implements IIndexDocument, JsonSerializable {
|
||||
/** @var string */
|
||||
protected $id = '';
|
||||
protected string $id = '';
|
||||
|
||||
/** @var string */
|
||||
protected $providerId = '';
|
||||
protected DocumentAccess $access;
|
||||
|
||||
/** @var DocumentAccess */
|
||||
protected $access;
|
||||
protected ?IIndex $index = null;
|
||||
|
||||
/** @var IIndex */
|
||||
protected $index;
|
||||
protected int $modifiedTime = 0;
|
||||
|
||||
/** @var int */
|
||||
protected $modifiedTime = 0;
|
||||
protected string $source = '';
|
||||
|
||||
/** @var string */
|
||||
protected $source = '';
|
||||
protected array $tags = [];
|
||||
|
||||
/** @var array */
|
||||
protected $tags = [];
|
||||
protected array $metaTags = [];
|
||||
|
||||
/** @var array */
|
||||
protected $metaTags = [];
|
||||
protected array $subTags = [];
|
||||
|
||||
/** @var array */
|
||||
protected $subTags = [];
|
||||
protected string $title = '';
|
||||
|
||||
/** @var string */
|
||||
protected $title = '';
|
||||
protected string $content = '';
|
||||
|
||||
/** @var string */
|
||||
protected $content = '';
|
||||
protected string $hash = '';
|
||||
|
||||
/** @var string */
|
||||
protected $hash = '';
|
||||
protected array $parts = [];
|
||||
|
||||
/** @var array */
|
||||
protected $parts = [];
|
||||
protected string $link = '';
|
||||
|
||||
/** @var string */
|
||||
protected $link = '';
|
||||
protected array $more = [];
|
||||
|
||||
/** @var array */
|
||||
protected $more = [];
|
||||
protected array $excerpts = [];
|
||||
|
||||
/** @var array */
|
||||
protected $excerpts = [];
|
||||
protected string $score = '';
|
||||
|
||||
/** @var string */
|
||||
protected $score = '';
|
||||
protected array $info = [];
|
||||
|
||||
/** @var array */
|
||||
protected $info = [];
|
||||
|
||||
/** @var int */
|
||||
protected $contentEncoded = 0;
|
||||
protected int $contentEncoded = 0;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -112,12 +92,11 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* and the Id of the original document.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $providerId
|
||||
* @param string $documentId
|
||||
*/
|
||||
public function __construct(string $providerId, string $documentId) {
|
||||
$this->providerId = $providerId;
|
||||
public function __construct(
|
||||
protected string $providerId,
|
||||
string $documentId,
|
||||
) {
|
||||
$this->id = $documentId;
|
||||
}
|
||||
|
||||
|
@ -126,8 +105,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Returns the Id of the original document.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
final public function getId(): string {
|
||||
return $this->id;
|
||||
|
@ -138,8 +115,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Returns the Id of the provider.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
final public function getProviderId(): string {
|
||||
return $this->providerId;
|
||||
|
@ -152,10 +127,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* @see IIndex
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param IIndex $index
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function setIndex(IIndex $index): IIndexDocument {
|
||||
$this->index = $index;
|
||||
|
@ -166,11 +137,14 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
/**
|
||||
* Get the Index.
|
||||
*
|
||||
* @throws FullTextSearchIndexNotAvailableException
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return IIndex
|
||||
*/
|
||||
final public function getIndex(): IIndex {
|
||||
if ($this->index === null) {
|
||||
throw new FullTextSearchIndexNotAvailableException('No IIndex generated');
|
||||
}
|
||||
|
||||
return $this->index;
|
||||
}
|
||||
|
||||
|
@ -178,22 +152,15 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* return if Index is defined.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
final public function hasIndex(): bool {
|
||||
return ($this->index !== null);
|
||||
return $this->index !== null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the modified time of the original document.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param int $modifiedTime
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function setModifiedTime(int $modifiedTime): IIndexDocument {
|
||||
$this->modifiedTime = $modifiedTime;
|
||||
|
@ -205,8 +172,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Get the modified time of the original document.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
final public function getModifiedTime(): int {
|
||||
return $this->modifiedTime;
|
||||
|
@ -216,10 +181,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Check if the original document of the IIndexDocument is older than $time.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param int $time
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
final public function isOlderThan(int $time): bool {
|
||||
return ($this->modifiedTime < $time);
|
||||
|
@ -232,10 +193,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* @see IDocumentAccess
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param IDocumentAccess $access
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function setAccess(IDocumentAccess $access): IIndexDocument {
|
||||
$this->access = $access;
|
||||
|
@ -247,8 +204,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Get the IDocumentAccess related to the original document.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return IDocumentAccess
|
||||
*/
|
||||
final public function getAccess(): IDocumentAccess {
|
||||
return $this->access;
|
||||
|
@ -259,10 +214,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Add a tag to the list.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $tag
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function addTag(string $tag): IIndexDocument {
|
||||
$this->tags[] = $tag;
|
||||
|
@ -274,10 +225,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Set the list of tags assigned to the original document.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param array $tags
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function setTags(array $tags): IIndexDocument {
|
||||
$this->tags = $tags;
|
||||
|
@ -289,8 +236,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Get the list of tags assigned to the original document.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
final public function getTags(): array {
|
||||
return $this->tags;
|
||||
|
@ -301,10 +246,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Add a meta tag to the list.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $tag
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function addMetaTag(string $tag): IIndexDocument {
|
||||
$this->metaTags[] = $tag;
|
||||
|
@ -316,10 +257,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Set the list of meta tags assigned to the original document.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param array $tags
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function setMetaTags(array $tags): IIndexDocument {
|
||||
$this->metaTags = $tags;
|
||||
|
@ -331,8 +268,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Get the list of meta tags assigned to the original document.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
final public function getMetaTags(): array {
|
||||
return $this->metaTags;
|
||||
|
@ -343,11 +278,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Add a sub tag to the list.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $sub
|
||||
* @param string $tag
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function addSubTag(string $sub, string $tag): IIndexDocument {
|
||||
if (!array_key_exists($sub, $this->subTags)) {
|
||||
|
@ -364,10 +294,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Set the list of sub tags assigned to the original document.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param array $tags
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function setSubTags(array $tags): IIndexDocument {
|
||||
$this->subTags = $tags;
|
||||
|
@ -381,10 +307,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* dimensional array.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param bool $formatted
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
final public function getSubTags(bool $formatted = false): array {
|
||||
if ($formatted === false) {
|
||||
|
@ -408,10 +330,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Set the source of the original document.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $source
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function setSource(string $source): IIndexDocument {
|
||||
$this->source = $source;
|
||||
|
@ -423,8 +341,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Get the source of the original document.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
final public function getSource(): string {
|
||||
return $this->source;
|
||||
|
@ -435,10 +351,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Set the title of the original document.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $title
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function setTitle(string $title): IIndexDocument {
|
||||
$this->title = $title;
|
||||
|
@ -450,8 +362,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Get the title of the original document.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
final public function getTitle(): string {
|
||||
return $this->title;
|
||||
|
@ -464,11 +374,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* encoded in base64.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $content
|
||||
* @param int $encoded
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function setContent(string $content, int $encoded = 0): IIndexDocument {
|
||||
$this->content = $content;
|
||||
|
@ -481,8 +386,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Get the content of the original document.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
final public function getContent(): string {
|
||||
return $this->content;
|
||||
|
@ -492,8 +395,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Returns the type of the encoding on the content.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
final public function isContentEncoded(): int {
|
||||
return $this->contentEncoded;
|
||||
|
@ -503,8 +404,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Return the size of the content.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
final public function getContentSize(): int {
|
||||
return strlen($this->getContent());
|
||||
|
@ -512,11 +411,9 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
|
||||
|
||||
/**
|
||||
* Generate an hash, based on the content of the original document.
|
||||
* Generate a hash, based on the content of the original document.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function initHash(): IIndexDocument {
|
||||
if ($this->getContent() === '' || is_null($this->getContent())) {
|
||||
|
@ -532,10 +429,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Set the hash of the original document.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $hash
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function setHash(string $hash): IIndexDocument {
|
||||
$this->hash = $hash;
|
||||
|
@ -547,8 +440,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Get the hash of the original document.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
final public function getHash(): string {
|
||||
return $this->hash;
|
||||
|
@ -562,11 +453,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* $part string.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $part
|
||||
* @param string $content
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function addPart(string $part, string $content): IIndexDocument {
|
||||
$this->parts[$part] = $content;
|
||||
|
@ -578,10 +464,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Set all parts and their content.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param array $parts
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function setParts(array $parts): IIndexDocument {
|
||||
$this->parts = $parts;
|
||||
|
@ -593,8 +475,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Get all parts of the IIndexDocument.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
final public function getParts(): array {
|
||||
return $this->parts;
|
||||
|
@ -605,10 +485,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Add a link, usable by the frontend.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $link
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function setLink(string $link): IIndexDocument {
|
||||
$this->link = $link;
|
||||
|
@ -620,8 +496,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Get the link.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
final public function getLink(): string {
|
||||
return $this->link;
|
||||
|
@ -632,10 +506,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Set more information that couldn't be set using other method.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param array $more
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function setMore(array $more): IIndexDocument {
|
||||
$this->more = $more;
|
||||
|
@ -647,8 +517,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Get more information.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
final public function getMore(): array {
|
||||
return $this->more;
|
||||
|
@ -660,11 +528,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* on the search request.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @param string $source
|
||||
* @param string $excerpt
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function addExcerpt(string $source, string $excerpt): IIndexDocument {
|
||||
$this->excerpts[] =
|
||||
|
@ -681,10 +544,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Set all excerpts of the content of the original document.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @param array $excerpts
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function setExcerpts(array $excerpts): IIndexDocument {
|
||||
$new = [];
|
||||
|
@ -704,8 +563,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Get all excerpts of the content of the original document.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
final public function getExcerpts(): array {
|
||||
return $this->excerpts;
|
||||
|
@ -715,9 +572,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Clean excerpt.
|
||||
*
|
||||
* @since 16.0.0
|
||||
*
|
||||
* @param string $excerpt
|
||||
* @return string
|
||||
*/
|
||||
private function cleanExcerpt(string $excerpt): string {
|
||||
$excerpt = str_replace("\\n", ' ', $excerpt);
|
||||
|
@ -736,10 +590,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* request.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $score
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function setScore(string $score): IIndexDocument {
|
||||
$this->score = $score;
|
||||
|
@ -751,8 +601,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Get the score.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
final public function getScore(): string {
|
||||
return $this->score;
|
||||
|
@ -767,11 +615,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* indexing.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $info
|
||||
* @param string $value
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function setInfo(string $info, string $value): IIndexDocument {
|
||||
$this->info[$info] = $value;
|
||||
|
@ -783,11 +626,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Get an information about a document. (string)
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $info
|
||||
* @param string $default
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
final public function getInfo(string $info, string $default = ''): string {
|
||||
if (!key_exists($info, $this->info)) {
|
||||
|
@ -805,11 +643,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* indexing.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $info
|
||||
* @param array $value
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function setInfoArray(string $info, array $value): IIndexDocument {
|
||||
$this->info[$info] = $value;
|
||||
|
@ -821,11 +654,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Get an information about a document. (array)
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $info
|
||||
* @param array $default
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
final public function getInfoArray(string $info, array $default = []): array {
|
||||
if (!key_exists($info, $this->info)) {
|
||||
|
@ -843,11 +671,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* indexing.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $info
|
||||
* @param int $value
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function setInfoInt(string $info, int $value): IIndexDocument {
|
||||
$this->info[$info] = $value;
|
||||
|
@ -859,11 +682,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Get an information about a document. (int)
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $info
|
||||
* @param int $default
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
final public function getInfoInt(string $info, int $default = 0): int {
|
||||
if (!key_exists($info, $this->info)) {
|
||||
|
@ -881,11 +699,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* indexing.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $info
|
||||
* @param bool $value
|
||||
*
|
||||
* @return IIndexDocument
|
||||
*/
|
||||
final public function setInfoBool(string $info, bool $value): IIndexDocument {
|
||||
$this->info[$info] = $value;
|
||||
|
@ -897,11 +710,6 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Get an information about a document. (bool)
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $info
|
||||
* @param bool $default
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
final public function getInfoBool(string $info, bool $default = false): bool {
|
||||
if (!key_exists($info, $this->info)) {
|
||||
|
@ -915,13 +723,11 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
* Get all info.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
final public function getInfoAll(): array {
|
||||
$info = [];
|
||||
foreach ($this->info as $k => $v) {
|
||||
if (substr($k, 0, 1) === '_') {
|
||||
if (str_starts_with($k, '_')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,22 +36,6 @@ use OCP\FullTextSearch\Model\ISearchOption;
|
|||
* @package OC\FullTextSearch\Model
|
||||
*/
|
||||
final class SearchOption implements ISearchOption, JsonSerializable {
|
||||
/** @var string */
|
||||
private $name = '';
|
||||
|
||||
/** @var string */
|
||||
private $title = '';
|
||||
|
||||
/** @var string */
|
||||
private $type = '';
|
||||
|
||||
/** @var string */
|
||||
private $size = '';
|
||||
|
||||
/** @var string */
|
||||
private $placeholder = '';
|
||||
|
||||
|
||||
/**
|
||||
* *
|
||||
*
|
||||
|
@ -104,37 +88,28 @@ final class SearchOption implements ISearchOption, JsonSerializable {
|
|||
/**
|
||||
* ISearchOption constructor.
|
||||
*
|
||||
* Some value can be setduring the creation of the object.
|
||||
* Some value can be set during the creation of the object.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $title
|
||||
* @param string $type
|
||||
* @param string $size
|
||||
* @param string $placeholder
|
||||
*/
|
||||
public function __construct(string $name = '', string $title = '', string $type = '', string $size = '', string $placeholder = '') {
|
||||
$this->name = $name;
|
||||
$this->title = $title;
|
||||
$this->type = $type;
|
||||
$this->size = $size;
|
||||
$this->placeholder = $placeholder;
|
||||
public function __construct(
|
||||
private string $name = '',
|
||||
private string $title = '',
|
||||
private string $type = '',
|
||||
private string $size = '',
|
||||
private string $placeholder = '',
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the name/key of the option.
|
||||
* The string should only contains alphanumerical chars and underscore.
|
||||
* The key can be retrieve when using ISearchRequest::getOption
|
||||
* The string should only contain alphanumerical chars and underscore.
|
||||
* The key can be retrieved when using ISearchRequest::getOption
|
||||
*
|
||||
* @see ISearchRequest::getOption
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return ISearchOption
|
||||
*/
|
||||
public function setName(string $name): ISearchOption {
|
||||
$this->name = $name;
|
||||
|
@ -146,8 +121,6 @@ final class SearchOption implements ISearchOption, JsonSerializable {
|
|||
* Get the name/key of the option.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string {
|
||||
return $this->name;
|
||||
|
@ -158,10 +131,6 @@ final class SearchOption implements ISearchOption, JsonSerializable {
|
|||
* Set the title/display name of the option.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $title
|
||||
*
|
||||
* @return ISearchOption
|
||||
*/
|
||||
public function setTitle(string $title): ISearchOption {
|
||||
$this->title = $title;
|
||||
|
@ -173,8 +142,6 @@ final class SearchOption implements ISearchOption, JsonSerializable {
|
|||
* Get the title of the option.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle(): string {
|
||||
return $this->title;
|
||||
|
@ -186,10 +153,6 @@ final class SearchOption implements ISearchOption, JsonSerializable {
|
|||
* $type can be ISearchOption::CHECKBOX or ISearchOption::INPUT
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return ISearchOption
|
||||
*/
|
||||
public function setType(string $type): ISearchOption {
|
||||
$this->type = $type;
|
||||
|
@ -201,8 +164,6 @@ final class SearchOption implements ISearchOption, JsonSerializable {
|
|||
* Get the type of the option.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType(): string {
|
||||
return $this->type;
|
||||
|
@ -214,10 +175,6 @@ final class SearchOption implements ISearchOption, JsonSerializable {
|
|||
* Value can be ISearchOption::INPUT_SMALL or not defined.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $size
|
||||
*
|
||||
* @return ISearchOption
|
||||
*/
|
||||
public function setSize(string $size): ISearchOption {
|
||||
$this->size = $size;
|
||||
|
@ -229,23 +186,16 @@ final class SearchOption implements ISearchOption, JsonSerializable {
|
|||
* Get the size of the INPUT.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSize(): string {
|
||||
return $this->size;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* In case of Type is , set the placeholder to be displayed in the input
|
||||
* field.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $placeholder
|
||||
*
|
||||
* @return ISearchOption
|
||||
*/
|
||||
public function setPlaceholder(string $placeholder): ISearchOption {
|
||||
$this->placeholder = $placeholder;
|
||||
|
@ -257,18 +207,13 @@ final class SearchOption implements ISearchOption, JsonSerializable {
|
|||
* Get the placeholder.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPlaceholder(): string {
|
||||
return $this->placeholder;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize(): array {
|
||||
return [
|
||||
|
|
|
@ -37,34 +37,24 @@ use OCP\FullTextSearch\Model\ISearchRequestSimpleQuery;
|
|||
* @package OC\FullTextSearch\Model
|
||||
*/
|
||||
final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonSerializable {
|
||||
/** @var int */
|
||||
private $type = 0;
|
||||
|
||||
/** @var string */
|
||||
private $field = '';
|
||||
|
||||
/** @var array */
|
||||
private $values = [];
|
||||
private array $values = [];
|
||||
|
||||
|
||||
/**
|
||||
* SearchRequestQuery constructor.
|
||||
*
|
||||
* @param $type
|
||||
* @param $field
|
||||
*
|
||||
* @since 17.0.0
|
||||
*/
|
||||
public function __construct(string $field, int $type) {
|
||||
$this->field = $field;
|
||||
$this->type = $type;
|
||||
public function __construct(
|
||||
private string $field,
|
||||
private int $type,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the compare type of the query
|
||||
*
|
||||
* @return int
|
||||
* @since 17.0.0
|
||||
*/
|
||||
public function getType(): int {
|
||||
|
@ -75,7 +65,6 @@ final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonS
|
|||
/**
|
||||
* Get the field to apply query
|
||||
*
|
||||
* @return string
|
||||
* @since 17.0.0
|
||||
*/
|
||||
public function getField(): string {
|
||||
|
@ -85,9 +74,6 @@ final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonS
|
|||
/**
|
||||
* Set the field to apply query
|
||||
*
|
||||
* @param string $field
|
||||
*
|
||||
* @return ISearchRequestSimpleQuery
|
||||
* @since 17.0.0
|
||||
*/
|
||||
public function setField(string $field): ISearchRequestSimpleQuery {
|
||||
|
@ -100,7 +86,6 @@ final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonS
|
|||
/**
|
||||
* Get the value to compare (string)
|
||||
*
|
||||
* @return array
|
||||
* @since 17.0.0
|
||||
*/
|
||||
public function getValues(): array {
|
||||
|
@ -111,9 +96,6 @@ final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonS
|
|||
/**
|
||||
* Add value to compare (string)
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return ISearchRequestSimpleQuery
|
||||
* @since 17.0.0
|
||||
*/
|
||||
public function addValue(string $value): ISearchRequestSimpleQuery {
|
||||
|
@ -125,9 +107,6 @@ final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonS
|
|||
/**
|
||||
* Add value to compare (int)
|
||||
*
|
||||
* @param int $value
|
||||
*
|
||||
* @return ISearchRequestSimpleQuery
|
||||
* @since 17.0.0
|
||||
*/
|
||||
public function addValueInt(int $value): ISearchRequestSimpleQuery {
|
||||
|
@ -139,9 +118,6 @@ final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonS
|
|||
/**
|
||||
* Add value to compare (array)
|
||||
*
|
||||
* @param array $value
|
||||
*
|
||||
* @return ISearchRequestSimpleQuery
|
||||
* @since 17.0.0
|
||||
*/
|
||||
public function addValueArray(array $value): ISearchRequestSimpleQuery {
|
||||
|
@ -153,9 +129,6 @@ final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonS
|
|||
/**
|
||||
* Add value to compare (bool)
|
||||
*
|
||||
* @param bool $value
|
||||
*
|
||||
* @return ISearchRequestSimpleQuery
|
||||
* @since 17.0.0
|
||||
*/
|
||||
public function addValueBool(bool $value): ISearchRequestSimpleQuery {
|
||||
|
|
|
@ -56,21 +56,13 @@ use OCP\FullTextSearch\Model\ISearchTemplate;
|
|||
* @package OC\FullTextSearch\Model
|
||||
*/
|
||||
final class SearchTemplate implements ISearchTemplate, JsonSerializable {
|
||||
/** @var string */
|
||||
private $icon = '';
|
||||
|
||||
/** @var string */
|
||||
private $css = '';
|
||||
|
||||
/** @var string */
|
||||
private $template = '';
|
||||
private string $template = '';
|
||||
|
||||
/** @var SearchOption[] */
|
||||
private $panelOptions = [];
|
||||
private array $panelOptions = [];
|
||||
|
||||
/** @var SearchOption[] */
|
||||
private $navigationOptions = [];
|
||||
|
||||
private array $navigationOptions = [];
|
||||
|
||||
/**
|
||||
* ISearchTemplate constructor.
|
||||
|
@ -79,13 +71,11 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable {
|
|||
* creation of the object.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $icon
|
||||
* @param string $css
|
||||
*/
|
||||
public function __construct(string $icon = '', string $css = '') {
|
||||
$this->icon = $icon;
|
||||
$this->css = $css;
|
||||
public function __construct(
|
||||
private string $icon = '',
|
||||
private string $css = '',
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
|
@ -94,10 +84,6 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable {
|
|||
* FullTextSearch navigation page, in front of the related Content Provider.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $class
|
||||
*
|
||||
* @return ISearchTemplate
|
||||
*/
|
||||
public function setIcon(string $class): ISearchTemplate {
|
||||
$this->icon = $class;
|
||||
|
@ -107,10 +93,6 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable {
|
|||
|
||||
/**
|
||||
* Get the class of the icon.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIcon(): string {
|
||||
return $this->icon;
|
||||
|
@ -121,10 +103,6 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable {
|
|||
* Set the path of a CSS file that will be loaded when needed.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $css
|
||||
*
|
||||
* @return ISearchTemplate
|
||||
*/
|
||||
public function setCss(string $css): ISearchTemplate {
|
||||
$this->css = $css;
|
||||
|
@ -136,8 +114,6 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable {
|
|||
* Get the path of the CSS file.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCss(): string {
|
||||
return $this->css;
|
||||
|
@ -151,10 +127,6 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable {
|
|||
* a way not generated by FullTextSearch
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param string $template
|
||||
*
|
||||
* @return ISearchTemplate
|
||||
*/
|
||||
public function setTemplate(string $template): ISearchTemplate {
|
||||
$this->template = $template;
|
||||
|
@ -166,8 +138,6 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable {
|
|||
* Get the path of the template file.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTemplate(): string {
|
||||
return $this->template;
|
||||
|
@ -181,10 +151,6 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable {
|
|||
* @see ISearchOption
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param ISearchOption $option
|
||||
*
|
||||
* @return ISearchTemplate
|
||||
*/
|
||||
public function addPanelOption(ISearchOption $option): ISearchTemplate {
|
||||
$this->panelOptions[] = $option;
|
||||
|
@ -210,10 +176,6 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable {
|
|||
* @see ISearchOption
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @param ISearchOption $option
|
||||
*
|
||||
* @return ISearchTemplate
|
||||
*/
|
||||
public function addNavigationOption(ISearchOption $option): ISearchTemplate {
|
||||
$this->navigationOptions[] = $option;
|
||||
|
@ -225,8 +187,6 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable {
|
|||
* Get all options to be displayed in the FullTextSearch navigation page.
|
||||
*
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getNavigationOptions(): array {
|
||||
return $this->navigationOptions;
|
||||
|
@ -235,8 +195,6 @@ final class SearchTemplate implements ISearchTemplate, JsonSerializable {
|
|||
|
||||
/**
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize(): array {
|
||||
return [
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2023, Faraz Samapoor <f.samapoor@gmail.com>
|
||||
*
|
||||
* @author Faraz Samapoor <f.samapoor@gmail.com>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
namespace OCP\FullTextSearch\Exceptions;
|
||||
|
||||
/**
|
||||
* @since 28.0.0
|
||||
*
|
||||
* Class FullTextSearchIndexNotAvailableException
|
||||
*
|
||||
*/
|
||||
class FullTextSearchIndexNotAvailableException extends \Exception {
|
||||
}
|
Loading…
Reference in New Issue