summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Files
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2017-06-14 18:11:55 +0200
committerRobin Appelman <robin@icewind.nl>2017-08-26 10:18:19 +0200
commit37e8b698f71481fe420a8eb248a5f604cd732cbd (patch)
treededebf15d9c9d7aaa1eee8302369c37a6d50a052 /apps/dav/lib/Files
parentca490bafb950b9d16ab4543ae810c3a67cb84d5b (diff)
downloadnextcloud-server-37e8b698f71481fe420a8eb248a5f604cd732cbd.tar.gz
nextcloud-server-37e8b698f71481fe420a8eb248a5f604cd732cbd.zip
cache nodes from search results
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/dav/lib/Files')
-rw-r--r--apps/dav/lib/Files/FileSearchBackend.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/dav/lib/Files/FileSearchBackend.php b/apps/dav/lib/Files/FileSearchBackend.php
index 0d837807fd8..515e7ed0121 100644
--- a/apps/dav/lib/Files/FileSearchBackend.php
+++ b/apps/dav/lib/Files/FileSearchBackend.php
@@ -26,6 +26,7 @@ use OC\Files\Search\SearchComparison;
use OC\Files\Search\SearchOrder;
use OC\Files\Search\SearchQuery;
use OC\Files\View;
+use OCA\DAV\Connector\Sabre\CachingTree;
use OCA\DAV\Connector\Sabre\Directory;
use OCA\DAV\Connector\Sabre\FilesPlugin;
use OCA\DAV\Connector\Sabre\TagsPlugin;
@@ -39,7 +40,6 @@ use OCP\Files\Search\ISearchQuery;
use OCP\IUser;
use OCP\Share\IManager;
use Sabre\DAV\Exception\NotFound;
-use Sabre\DAV\Tree;
use SearchDAV\Backend\ISearchBackend;
use SearchDAV\Backend\SearchPropertyDefinition;
use SearchDAV\Backend\SearchResult;
@@ -49,7 +49,7 @@ use SearchDAV\XML\Operator;
use SearchDAV\XML\Order;
class FileSearchBackend implements ISearchBackend {
- /** @var Tree */
+ /** @var CachingTree */
private $tree;
/** @var IUser */
@@ -67,14 +67,14 @@ class FileSearchBackend implements ISearchBackend {
/**
* FileSearchBackend constructor.
*
- * @param Tree $tree
+ * @param CachingTree $tree
* @param IUser $user
* @param IRootFolder $rootFolder
* @param IManager $shareManager
* @param View $view
* @internal param IRootFolder $rootFolder
*/
- public function __construct(Tree $tree, IUser $user, IRootFolder $rootFolder, IManager $shareManager, View $view) {
+ public function __construct(CachingTree $tree, IUser $user, IRootFolder $rootFolder, IManager $shareManager, View $view) {
$this->tree = $tree;
$this->user = $user;
$this->rootFolder = $rootFolder;
@@ -157,10 +157,13 @@ class FileSearchBackend implements ISearchBackend {
return array_map(function (Node $node) {
if ($node instanceof Folder) {
- return new SearchResult(new \OCA\DAV\Connector\Sabre\Directory($this->view, $node, $this->tree, $this->shareManager), $this->getHrefForNode($node));
+ $davNode = new \OCA\DAV\Connector\Sabre\Directory($this->view, $node, $this->tree, $this->shareManager);
} else {
- return new SearchResult(new \OCA\DAV\Connector\Sabre\File($this->view, $node, $this->shareManager), $this->getHrefForNode($node));
+ $davNode = new \OCA\DAV\Connector\Sabre\File($this->view, $node, $this->shareManager);
}
+ $path = $this->getHrefForNode($node);
+ $this->tree->cacheNode($davNode, $path);
+ return new SearchResult($davNode, $path);
}, $results);
}