From cfe1ee7e51753ef65d1d0b7628c029b83777eba1 Mon Sep 17 00:00:00 2001 From: Silvio Date: Tue, 10 Jan 2023 08:11:01 -0300 Subject: [PATCH] User and owner filter The use of "keyword" will allow the search key to be exact, Elasticsearch will not perform any transformations. This use case will consider external user sources (LDAP), where the username may have dashes or symbols that could be misinterpreted by the engine. Signed-off-by: Silvio --- lib/Service/SearchMappingService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Service/SearchMappingService.php b/lib/Service/SearchMappingService.php index 6cf4bf84..35187ca0 100644 --- a/lib/Service/SearchMappingService.php +++ b/lib/Service/SearchMappingService.php @@ -320,9 +320,9 @@ private function generateQueryContentFields(ISearchRequest $request, QueryConten private function generateSearchQueryAccess(IDocumentAccess $access): array { $query = []; - $query[] = ['term' => ['owner' => $access->getViewerId()]]; - $query[] = ['term' => ['users' => $access->getViewerId()]]; - $query[] = ['term' => ['users' => '__all']]; + $query[] = ['term' => ['owner.keyword' => $access->getViewerId()]]; + $query[] = ['term' => ['users.keyword' => $access->getViewerId()]]; + $query[] = ['term' => ['users.keyword' => '__all']]; foreach ($access->getGroups() as $group) { $query[] = ['term' => ['groups' => $group]];