mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Merge pull request #33574 from nextcloud/search-share-query-filter-no-init
directly build the search filter for shared storage instead of setting up the source cache
This commit is contained in:
commit
5f90a6a5e2
2 changed files with 10 additions and 4 deletions
|
|
@ -183,16 +183,18 @@ class Cache extends CacheJail {
|
|||
}
|
||||
|
||||
public function getQueryFilterForStorage(): ISearchOperator {
|
||||
$storageFilter = \OC\Files\Cache\Cache::getQueryFilterForStorage();
|
||||
|
||||
// Do the normal jail behavior for non files
|
||||
if ($this->storage->getItemType() !== 'file') {
|
||||
return parent::getQueryFilterForStorage();
|
||||
return $this->addJailFilterQuery($storageFilter);
|
||||
}
|
||||
|
||||
// for single file shares we don't need to do the LIKE
|
||||
return new SearchBinaryOperator(
|
||||
ISearchBinaryOperator::OPERATOR_AND,
|
||||
[
|
||||
\OC\Files\Cache\Cache::getQueryFilterForStorage(),
|
||||
$storageFilter,
|
||||
new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', $this->getGetUnjailedRoot()),
|
||||
]
|
||||
);
|
||||
|
|
|
|||
|
|
@ -306,10 +306,14 @@ class CacheJail extends CacheWrapper {
|
|||
}
|
||||
|
||||
public function getQueryFilterForStorage(): ISearchOperator {
|
||||
return $this->addJailFilterQuery($this->getCache()->getQueryFilterForStorage());
|
||||
}
|
||||
|
||||
protected function addJailFilterQuery(ISearchOperator $filter): ISearchOperator {
|
||||
if ($this->getGetUnjailedRoot() !== '' && $this->getGetUnjailedRoot() !== '/') {
|
||||
return new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND,
|
||||
[
|
||||
$this->getCache()->getQueryFilterForStorage(),
|
||||
$filter,
|
||||
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR,
|
||||
[
|
||||
new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', $this->getGetUnjailedRoot()),
|
||||
|
|
@ -319,7 +323,7 @@ class CacheJail extends CacheWrapper {
|
|||
]
|
||||
);
|
||||
} else {
|
||||
return $this->getCache()->getQueryFilterForStorage();
|
||||
return $filter;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue