Skip to content

Commit

Permalink
fixup! feat(dav): Support multiple scopes in DAV search
Browse files Browse the repository at this point in the history
  • Loading branch information
artonge committed Apr 16, 2024
1 parent 91e6cdd commit 817ac06
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions apps/dav/lib/Files/FileSearchBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ public function search(Query $search): array {
if (!$node instanceof Directory) {
throw new \InvalidArgumentException('Search is only supported on directories');
}

$fileInfo = $node->getFileInfo();
/** @var Folder $folder */
$folder = $this->rootFolder->get($fileInfo->getPath());
Expand All @@ -179,11 +180,23 @@ public function search(Query $search): array {
} else {
$internalPath = $folder->getInternalPath();
}
$scopes[] = new SearchComparison(
ISearchComparison::COMPARE_LIKE,
'path',
$internalPath . '/%',
''

$scopes[] = new SearchBinaryOperator(
ISearchBinaryOperator::OPERATOR_AND,
[
new SearchComparison(
ISearchComparison::COMPARE_EQUAL,
'storage',
$folderStorage->getCache()->getNumericStorageId(),
''
),
new SearchComparison(
ISearchComparison::COMPARE_LIKE,
'path',
$internalPath . '/%',
''
),
]
);
}

Expand Down

0 comments on commit 817ac06

Please sign in to comment.