[xwiki-users] How to select a subset of tags with HQL
Hello again, So my next dilema is structuring the 'All Tags' page. Currently, there is a list of all tags on all pages on all spaces, in alphabetical order. All good here. However, the way I'm utilizing the tags, there are certain groups of tags that all have the same prefix, for example a group of tags that all start with 'xyz-', or another group that all starts with 'zyx-'. So, I'm trying to build an HQL statement that just selects those tags that contain the prefix 'xyz-', for example. The HQL I'm using to select ALL tags is as follows: select distinct elements(prop.list) from BaseObject as obj, DBStringListProperty as prop where obj.className='XWiki.TagClass' and obj.id=prop.id.id and prop.id.name='tags' order by 1 asc I've tried appending additional where clauses trying to just selec the tags with the 'xyz-' prefix wihtout any luck. I've tried such things as: ... and prop.value LIKE 'xyz-%' ... and prop.id.value LIKE 'xyz-%' ... and obj.value LIKE 'xyz-%' ... and obj.id.value LIKE 'xyz-%' ... None of these seem to work however. Does anyone have any suggestions or a workaround? Any and all input is greatly appreciated. Thank you in advance community! Cheers -- View this message in context: http://n2.nabble.com/How-to-select-a-subset-of-tags-with-HQL-tp1466640p14666... Sent from the XWiki- Users mailing list archive at Nabble.com.
BrianJones wrote:
Hello again,
So my next dilema is structuring the 'All Tags' page. Currently, there is a list of all tags on all pages on all spaces, in alphabetical order. All good here.
However, the way I'm utilizing the tags, there are certain groups of tags that all have the same prefix, for example a group of tags that all start with 'xyz-', or another group that all starts with 'zyx-'.
So, I'm trying to build an HQL statement that just selects those tags that contain the prefix 'xyz-', for example. The HQL I'm using to select ALL tags is as follows:
select distinct elements(prop.list) from BaseObject as obj, DBStringListProperty as prop where obj.className='XWiki.TagClass' and obj.id=prop.id.id and prop.id.name='tags' order by 1 asc
I've tried appending additional where clauses trying to just selec the tags with the 'xyz-' prefix wihtout any luck. I've tried such things as:
... and prop.value LIKE 'xyz-%' ... and prop.id.value LIKE 'xyz-%' ... and obj.value LIKE 'xyz-%' ... and obj.id.value LIKE 'xyz-%' ...
None of these seem to work however. Does anyone have any suggestions or a workaround? Any and all input is greatly appreciated. Thank you in advance community!
Cheers
select distinct tag from BaseObject as obj, DBStringListProperty as prop join prop.list as tag where obj.className='XWiki.TagClass' and obj.id=prop.id.id and prop.id.name='tags' and tag like 'xyz-%' order by 1 asc -- Sergiu Dumitriu http://purl.org/net/sergiu/
participants (2)
-
BrianJones -
Sergiu Dumitriu