2017-02-02 12:19:16 -05:00
|
|
|
<?php
|
|
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2017-02-02 12:19:16 -05:00
|
|
|
*/
|
|
|
|
|
namespace OCP\Files\Search;
|
|
|
|
|
|
2017-02-21 10:14:11 -05:00
|
|
|
/**
|
|
|
|
|
* @since 12.0.0
|
2024-02-06 04:59:17 -05:00
|
|
|
*
|
|
|
|
|
* @psalm-type ParamSingleValue = \DateTime|int|string|bool
|
|
|
|
|
* @psalm-type ParamValue = ParamSingleValue|list<ParamSingleValue>
|
2017-02-21 10:14:11 -05:00
|
|
|
*/
|
2017-02-02 12:19:16 -05:00
|
|
|
interface ISearchComparison extends ISearchOperator {
|
2024-02-14 14:48:27 -05:00
|
|
|
/**
|
|
|
|
|
* @since 12.0.0
|
|
|
|
|
*/
|
2020-04-10 10:54:27 -04:00
|
|
|
public const COMPARE_EQUAL = 'eq';
|
2024-02-14 14:48:27 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 12.0.0
|
|
|
|
|
*/
|
2020-04-10 10:54:27 -04:00
|
|
|
public const COMPARE_GREATER_THAN = 'gt';
|
2024-02-14 14:48:27 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 12.0.0
|
|
|
|
|
*/
|
2020-04-10 10:54:27 -04:00
|
|
|
public const COMPARE_GREATER_THAN_EQUAL = 'gte';
|
2024-02-14 14:48:27 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 12.0.0
|
|
|
|
|
*/
|
2020-04-10 10:54:27 -04:00
|
|
|
public const COMPARE_LESS_THAN = 'lt';
|
2024-02-14 14:48:27 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 12.0.0
|
|
|
|
|
*/
|
2020-04-10 10:54:27 -04:00
|
|
|
public const COMPARE_LESS_THAN_EQUAL = 'lte';
|
2024-02-14 14:48:27 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 12.0.0
|
|
|
|
|
*/
|
2020-04-10 10:54:27 -04:00
|
|
|
public const COMPARE_LIKE = 'like';
|
2024-02-14 14:48:27 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 23.0.0
|
|
|
|
|
*/
|
2021-08-17 07:50:13 -04:00
|
|
|
public const COMPARE_LIKE_CASE_SENSITIVE = 'clike';
|
2024-02-14 14:48:27 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 28.0.0
|
|
|
|
|
*/
|
2023-11-16 05:10:21 -05:00
|
|
|
public const COMPARE_DEFINED = 'is-defined';
|
2024-02-15 12:16:13 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 29.0.0
|
|
|
|
|
*/
|
2023-09-21 07:49:16 -04:00
|
|
|
public const COMPARE_IN = 'in';
|
2017-02-02 12:19:16 -05:00
|
|
|
|
2024-02-14 14:48:27 -05:00
|
|
|
/**
|
|
|
|
|
* @since 23.0.0
|
|
|
|
|
*/
|
2021-08-23 09:01:03 -04:00
|
|
|
public const HINT_PATH_EQ_HASH = 'path_eq_hash'; // transform `path = "$path"` into `path_hash = md5("$path")`, on by default
|
|
|
|
|
|
2017-02-02 12:19:16 -05:00
|
|
|
/**
|
|
|
|
|
* Get the type of comparison, one of the ISearchComparison::COMPARE_* constants
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
2017-02-02 12:20:08 -05:00
|
|
|
* @since 12.0.0
|
2017-02-02 12:19:16 -05:00
|
|
|
*/
|
2023-11-07 08:43:01 -05:00
|
|
|
public function getType(): string;
|
2017-02-02 12:19:16 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the name of the field to compare with
|
|
|
|
|
*
|
|
|
|
|
* i.e. 'size', 'name' or 'mimetype'
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
2017-02-02 12:20:08 -05:00
|
|
|
* @since 12.0.0
|
2017-02-02 12:19:16 -05:00
|
|
|
*/
|
2023-11-07 08:43:01 -05:00
|
|
|
public function getField(): string;
|
2023-11-06 20:21:29 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* extra means data are not related to the main files table
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
* @since 28.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function getExtra(): string;
|
|
|
|
|
|
2017-02-02 12:19:16 -05:00
|
|
|
/**
|
|
|
|
|
* Get the value to compare the field with
|
|
|
|
|
*
|
2024-02-06 04:59:17 -05:00
|
|
|
* @return ParamValue
|
2017-02-02 12:20:08 -05:00
|
|
|
* @since 12.0.0
|
2017-02-02 12:19:16 -05:00
|
|
|
*/
|
2023-09-21 07:49:16 -04:00
|
|
|
public function getValue(): string|int|bool|\DateTime|array;
|
2017-02-02 12:19:16 -05:00
|
|
|
}
|