From 5dba8d318dfbcd5b0e2a5feabe6e61882ef73c72 Mon Sep 17 00:00:00 2001
From: Roeland Jago Douma <roeland@famdouma.nl>
Date: Fri, 6 Dec 2019 11:29:14 +0100
Subject: [PATCH] Fix search limit to home

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
---
 lib/private/Files/Cache/Cache.php | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php
index 5c5146a569f..92e81cd0f07 100644
--- a/lib/private/Files/Cache/Cache.php
+++ b/lib/private/Files/Cache/Cache.php
@@ -797,6 +797,10 @@ class Cache implements ICache {
 			$query->andWhere($searchExpr);
 		}
 
+		if ($searchQuery->limitToHome() && ($this instanceof HomeCache)) {
+			$query->andWhere($builder->expr()->like('path', $query->expr()->literal('files/%')));
+		}
+
 		$this->querySearchHelper->addSearchOrdersToQuery($query, $searchQuery->getOrder());
 
 		if ($searchQuery->getLimit()) {
-- 
GitLab