Index: src/main/java/com/xpn/xwiki/user/impl/xwiki/XWikiGroupServiceImpl.java =================================================================== --- src/main/java/com/xpn/xwiki/user/impl/xwiki/XWikiGroupServiceImpl.java (revision 23903) +++ src/main/java/com/xpn/xwiki/user/impl/xwiki/XWikiGroupServiceImpl.java (working copy) @@ -567,7 +567,7 @@ String where = createMatchUserOrGroupWhereClause(user, matchFields, order, parameterValues); if (withdetails) { - groups = context.getWiki().getStore().searchDocuments(where, nb, start, parameterValues, context); + groups = context.getWiki().getStore().searchDocuments(where, false, nb, start, parameterValues, context); } else { groups = context.getWiki().getStore().searchDocumentsNames(where, nb, start, parameterValues, context); } @@ -666,10 +666,10 @@ StringBuffer queryString = new StringBuffer(); // Add from clause - queryString.append(" FROM XWikiDocument as doc, BaseObject as obj, StringProperty as field"); + queryString.append(" FROM BaseObject as obj, StringProperty as field"); // Add where clause - queryString.append(" WHERE doc.fullName=:groupdocname and doc.fullName=obj.name " + queryString.append(" WHERE obj.name=:groupdocname " + "and obj.className=:groupclassname and obj.id=field.id.id"); parameterValues.put("groupdocname", groupFullName); parameterValues.put("groupclassname", CLASS_XWIKIGROUPS); Index: src/main/resources/queries.hbm.xml =================================================================== --- src/main/resources/queries.hbm.xml (revision 23903) +++ src/main/resources/queries.hbm.xml (working copy) @@ -13,20 +13,20 @@ select distinct doc.space from XWikiDocument doc - select doc.fullName from XWikiDocument as doc + select distinct doc.fullName from XWikiDocument as doc - select doc.fullName from XWikiDocument as doc where (doc.hidden <> true or doc.hidden is null) + select distinct doc.fullName from XWikiDocument as doc where (doc.hidden <> true or doc.hidden is null) - select doc.fullName from XWikiDocument as doc, BaseObject as obj, StringProperty as prop + select distinct doc.fullName from XWikiDocument as doc, BaseObject as obj, StringProperty as prop where obj.name = doc.fullName and obj.className='XWiki.XWikiGroups' and obj.id = prop.id.id and prop.id.name='member' and (prop.value=:username or prop.value=:shortname or prop.value=:veryshortname) - select doc.fullName from XWikiDocument as doc, BaseObject as obj + select distinct doc.fullName from XWikiDocument as doc, BaseObject as obj where obj.name=doc.fullName and obj.className='XWiki.XWikiUsers'