From 26c1b6639fbbebf5454c4ac5fd6df8df263458ab Mon Sep 17 00:00:00 2001 From: Manuel Leduc Date: Thu, 11 Jan 2024 15:01:05 +0100 Subject: [PATCH] XWIKI-21786: The Live Data table in XWik.XWikiClasses (Data types page) shows an incorrect number of pages (cherry picked from commit 13c0a2eb3fcf0075eeac21ebb15a8e572e88132f) --- .../main/resources/XWiki/XWikiClassesLiveTableResults.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xwiki-platform-core/xwiki-platform-xclass/xwiki-platform-xclass-ui/src/main/resources/XWiki/XWikiClassesLiveTableResults.xml b/xwiki-platform-core/xwiki-platform-xclass/xwiki-platform-xclass-ui/src/main/resources/XWiki/XWikiClassesLiveTableResults.xml index eb78a90fc09b..91c653aca201 100644 --- a/xwiki-platform-core/xwiki-platform-xclass/xwiki-platform-xclass-ui/src/main/resources/XWiki/XWikiClassesLiveTableResults.xml +++ b/xwiki-platform-core/xwiki-platform-xclass/xwiki-platform-xclass-ui/src/main/resources/XWiki/XWikiClassesLiveTableResults.xml @@ -50,7 +50,10 @@ #foreach ($row in $output.rows) #set ($statement = ', BaseObject as obj where doc.translation = 0 and ' + 'doc.fullName = obj.name and obj.className = :className') - #set ($row.pageCount = $services.query.hql($statement).bindValue('className', $row.doc_fullName).count()) + ## Note: the unique filter is required as otherwise pages are returned once for each contained XObjects, leading + ## to larger counts than expected. + #set ($hqlQuery = $services.query.hql($statement).bindValue('className', $row.doc_fullName).addFilter('unique')) + #set ($row.pageCount = $hqlQuery.count()) #end #jsonResponse($output) #end