diff options
author | Robin Appelman <robin@icewind.nl> | 2021-05-04 19:06:02 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2021-06-14 16:11:22 +0200 |
commit | e198dc1b200f3ade93498e0ea7b468c87d46748a (patch) | |
tree | 235c30d6035bec46bef5ee2f2b134333dfb65409 /lib/public | |
parent | dfbac05f7ba00c78ac15df61a425317a890b08d1 (diff) | |
download | nextcloud-server-e198dc1b200f3ade93498e0ea7b468c87d46748a.tar.gz nextcloud-server-e198dc1b200f3ade93498e0ea7b468c87d46748a.zip |
rework search api to allow searching on multiple caches at once
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/Files/Cache/ICache.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/public/Files/Cache/ICache.php b/lib/public/Files/Cache/ICache.php index 60c59337077..9e11831aae7 100644 --- a/lib/public/Files/Cache/ICache.php +++ b/lib/public/Files/Cache/ICache.php @@ -22,6 +22,8 @@ */ namespace OCP\Files\Cache; +use OCP\DB\QueryBuilder\ICompositeExpression; +use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\Files\Search\ISearchQuery; /** @@ -264,4 +266,31 @@ interface ICache { * @since 9.0.0 */ public function normalize($path); + + /** + * Get the query expression required to filter files within this storage. + * + * In the most basic case this is just `$builder->expr()->eq('storage', $this->getNumericStorageId())` + * but storage wrappers can add additional expressions to filter down things further + * + * @param IQueryBuilder $builder + * @return string|ICompositeExpression + * @since 22.0.0 + */ + public function getQueryFilterForStorage(IQueryBuilder $builder); + + /** + * Construct a cache entry from a search result row *if* the entry belongs to this storage. + * + * This method will be called for every item in the search results, including results from different storages. + * It's the responsibility of this method to return `null` for all results that don't belong to this storage. + * + * Additionally some implementations might need to further process the resulting entry such as modifying the path + * or permissions of the result. + * + * @param ICacheEntry $rawEntry + * @return ICacheEntry|null + * @since 22.0.0 + */ + public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEntry; } |