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