searchHelper->getCachesAndMountPointsForSearch( $this->getRootFolder($folder), $folder->getPath(), ); return $this->searchHelper->findUsedTagsInCaches($query, $caches); } protected function getRootFolder(?Folder $folder): Root { if ($folder instanceof Root) { return $folder; } elseif ($folder === null) { throw new \LogicException('Could not climb up to root folder'); } return $this->getRootFolder($folder->getParent()); } }