@@ -39,69 +39,69 @@ |
||
| 39 | 39 | */ |
| 40 | 40 | interface IProvider { |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Get the unique ID of this search provider |
|
| 44 | - * |
|
| 45 | - * Ideally this should be the app name or an identifier identified with the |
|
| 46 | - * app name, especially if the app registers more than one provider. |
|
| 47 | - * |
|
| 48 | - * Example: 'mail', 'mail_recipients', 'files_sharing' |
|
| 49 | - * |
|
| 50 | - * @return string |
|
| 51 | - * |
|
| 52 | - * @since 20.0.0 |
|
| 53 | - */ |
|
| 54 | - public function getId(): string; |
|
| 42 | + /** |
|
| 43 | + * Get the unique ID of this search provider |
|
| 44 | + * |
|
| 45 | + * Ideally this should be the app name or an identifier identified with the |
|
| 46 | + * app name, especially if the app registers more than one provider. |
|
| 47 | + * |
|
| 48 | + * Example: 'mail', 'mail_recipients', 'files_sharing' |
|
| 49 | + * |
|
| 50 | + * @return string |
|
| 51 | + * |
|
| 52 | + * @since 20.0.0 |
|
| 53 | + */ |
|
| 54 | + public function getId(): string; |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Get the translated name of this search provider |
|
| 58 | - * |
|
| 59 | - * Example: 'Mail', 'Contacts'... |
|
| 60 | - * |
|
| 61 | - * @return string |
|
| 62 | - * |
|
| 63 | - * @since 20.0.0 |
|
| 64 | - */ |
|
| 65 | - public function getName(): string; |
|
| 56 | + /** |
|
| 57 | + * Get the translated name of this search provider |
|
| 58 | + * |
|
| 59 | + * Example: 'Mail', 'Contacts'... |
|
| 60 | + * |
|
| 61 | + * @return string |
|
| 62 | + * |
|
| 63 | + * @since 20.0.0 |
|
| 64 | + */ |
|
| 65 | + public function getName(): string; |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * Get the search provider order |
|
| 69 | - * The lower the int, the higher it will be sorted (0 will be before 10) |
|
| 70 | - * |
|
| 71 | - * @param string $route the route the user is currently at, e.g. files.view.index |
|
| 72 | - * @param array $routeParameters the parameters of the route the user is currently at, e.g. [fileId = 982, dir = "/"] |
|
| 73 | - * |
|
| 74 | - * @return int |
|
| 75 | - * |
|
| 76 | - * @since 20.0.0 |
|
| 77 | - */ |
|
| 78 | - public function getOrder(string $route, array $routeParameters): int; |
|
| 67 | + /** |
|
| 68 | + * Get the search provider order |
|
| 69 | + * The lower the int, the higher it will be sorted (0 will be before 10) |
|
| 70 | + * |
|
| 71 | + * @param string $route the route the user is currently at, e.g. files.view.index |
|
| 72 | + * @param array $routeParameters the parameters of the route the user is currently at, e.g. [fileId = 982, dir = "/"] |
|
| 73 | + * |
|
| 74 | + * @return int |
|
| 75 | + * |
|
| 76 | + * @since 20.0.0 |
|
| 77 | + */ |
|
| 78 | + public function getOrder(string $route, array $routeParameters): int; |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * Find matching search entries in an app |
|
| 82 | - * |
|
| 83 | - * Search results can either be a complete list of all the matches the app can |
|
| 84 | - * find, or ideally a paginated result set where more data can be fetched on |
|
| 85 | - * demand. To be able to tell where the next offset starts the search uses |
|
| 86 | - * "cursors" which are a property of the last result entry. E.g. search results |
|
| 87 | - * that show most recent entries first can look for entries older than the last |
|
| 88 | - * one of the first result set. This approach was chosen over a numeric limit/ |
|
| 89 | - * offset approach as the offset moves as new data comes in. The cursor is |
|
| 90 | - * resistant to these changes and will still show results without overlaps or |
|
| 91 | - * gaps. |
|
| 92 | - * |
|
| 93 | - * See https://dev.to/jackmarchant/offset-and-cursor-pagination-explained-b89 |
|
| 94 | - * for the concept of cursors. |
|
| 95 | - * |
|
| 96 | - * Implementations that return result pages have to adhere to the limit |
|
| 97 | - * property of a search query. |
|
| 98 | - * |
|
| 99 | - * @param IUser $user |
|
| 100 | - * @param ISearchQuery $query |
|
| 101 | - * |
|
| 102 | - * @return SearchResult |
|
| 103 | - * |
|
| 104 | - * @since 20.0.0 |
|
| 105 | - */ |
|
| 106 | - public function search(IUser $user, ISearchQuery $query): SearchResult; |
|
| 80 | + /** |
|
| 81 | + * Find matching search entries in an app |
|
| 82 | + * |
|
| 83 | + * Search results can either be a complete list of all the matches the app can |
|
| 84 | + * find, or ideally a paginated result set where more data can be fetched on |
|
| 85 | + * demand. To be able to tell where the next offset starts the search uses |
|
| 86 | + * "cursors" which are a property of the last result entry. E.g. search results |
|
| 87 | + * that show most recent entries first can look for entries older than the last |
|
| 88 | + * one of the first result set. This approach was chosen over a numeric limit/ |
|
| 89 | + * offset approach as the offset moves as new data comes in. The cursor is |
|
| 90 | + * resistant to these changes and will still show results without overlaps or |
|
| 91 | + * gaps. |
|
| 92 | + * |
|
| 93 | + * See https://dev.to/jackmarchant/offset-and-cursor-pagination-explained-b89 |
|
| 94 | + * for the concept of cursors. |
|
| 95 | + * |
|
| 96 | + * Implementations that return result pages have to adhere to the limit |
|
| 97 | + * property of a search query. |
|
| 98 | + * |
|
| 99 | + * @param IUser $user |
|
| 100 | + * @param ISearchQuery $query |
|
| 101 | + * |
|
| 102 | + * @return SearchResult |
|
| 103 | + * |
|
| 104 | + * @since 20.0.0 |
|
| 105 | + */ |
|
| 106 | + public function search(IUser $user, ISearchQuery $query): SearchResult; |
|
| 107 | 107 | } |
@@ -38,54 +38,54 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | interface ISearchQuery { |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @since 20.0.0 |
|
| 43 | - */ |
|
| 44 | - public const SORT_DATE_DESC = 1; |
|
| 41 | + /** |
|
| 42 | + * @since 20.0.0 |
|
| 43 | + */ |
|
| 44 | + public const SORT_DATE_DESC = 1; |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Get the user-entered search term to find matches for |
|
| 48 | - * |
|
| 49 | - * @return string the search term |
|
| 50 | - * @since 20.0.0 |
|
| 51 | - */ |
|
| 52 | - public function getTerm(): string; |
|
| 46 | + /** |
|
| 47 | + * Get the user-entered search term to find matches for |
|
| 48 | + * |
|
| 49 | + * @return string the search term |
|
| 50 | + * @since 20.0.0 |
|
| 51 | + */ |
|
| 52 | + public function getTerm(): string; |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Get the sort order of results as defined as SORT_* constants on this interface |
|
| 56 | - * |
|
| 57 | - * @return int |
|
| 58 | - * @since 20.0.0 |
|
| 59 | - */ |
|
| 60 | - public function getSortOrder(): int; |
|
| 54 | + /** |
|
| 55 | + * Get the sort order of results as defined as SORT_* constants on this interface |
|
| 56 | + * |
|
| 57 | + * @return int |
|
| 58 | + * @since 20.0.0 |
|
| 59 | + */ |
|
| 60 | + public function getSortOrder(): int; |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Get the number of items to return for a paginated result |
|
| 64 | - * |
|
| 65 | - * @return int |
|
| 66 | - * @see \OCP\Search\IProvider for details |
|
| 67 | - * @since 20.0.0 |
|
| 68 | - */ |
|
| 69 | - public function getLimit(): int; |
|
| 62 | + /** |
|
| 63 | + * Get the number of items to return for a paginated result |
|
| 64 | + * |
|
| 65 | + * @return int |
|
| 66 | + * @see \OCP\Search\IProvider for details |
|
| 67 | + * @since 20.0.0 |
|
| 68 | + */ |
|
| 69 | + public function getLimit(): int; |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Get the app-specific cursor of the tail of the previous result entries |
|
| 73 | - * |
|
| 74 | - * @return int|string|null |
|
| 75 | - * @see \OCP\Search\IProvider for details |
|
| 76 | - * @since 20.0.0 |
|
| 77 | - */ |
|
| 78 | - public function getCursor(); |
|
| 71 | + /** |
|
| 72 | + * Get the app-specific cursor of the tail of the previous result entries |
|
| 73 | + * |
|
| 74 | + * @return int|string|null |
|
| 75 | + * @see \OCP\Search\IProvider for details |
|
| 76 | + * @since 20.0.0 |
|
| 77 | + */ |
|
| 78 | + public function getCursor(); |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * @return string |
|
| 82 | - * @since 20.0.0 |
|
| 83 | - */ |
|
| 84 | - public function getRoute(): string; |
|
| 80 | + /** |
|
| 81 | + * @return string |
|
| 82 | + * @since 20.0.0 |
|
| 83 | + */ |
|
| 84 | + public function getRoute(): string; |
|
| 85 | 85 | |
| 86 | - /** |
|
| 87 | - * @return array |
|
| 88 | - * @since 20.0.0 |
|
| 89 | - */ |
|
| 90 | - public function getRouteParameters(): array; |
|
| 86 | + /** |
|
| 87 | + * @return array |
|
| 88 | + * @since 20.0.0 |
|
| 89 | + */ |
|
| 90 | + public function getRouteParameters(): array; |
|
| 91 | 91 | } |